mindref-etc / vim / vimrc.local

" Vim options
" ===========

set nocompatible

" Detect the type of file
"filetype on
" Load filetype plugins
filetype plugin on
" Load indent files for specific filetypes
filetype indent on

" The title of the window
set title
" Show the line and column number of the cursor position
set ruler
" Show (partial) command in status line.
set showcmd
" Comma separated list of screen columns that are highlighted
set colorcolumn=79
" Maximum width of text that is being inserted. A longer line will be
" broken after white space to get this width.
set textwidth=65

" Enable syntax highlighting
syntax on
" If using a dark background within the editing area and syntax
" highlighting turn on this option as well
set background=dark
" number of colors
set t_Co=256
" Load color scheme
colorscheme wombat256
" Turn on line numbers
set number

" Convert tabs to spaces
set expandtab
" Tabs = 4 spaces
set smarttab
set tabstop=4
" Indent/outdent 4 spaces
set shiftwidth=4

" Show matching brackets
set showmatch
" how many tenths of a second to blink matching
set matchtime=2

" Do case insensitive matching
set ignorecase
" Do smart case matching
set smartcase
" Incremental search
set incsearch
" Highlight search
set hlsearch
" Improves smoothness of redrawing
set ttyfast
" Do not redraw while running macros
set nolazyredraw
" Automatically save before commands like :next and :make
set autowrite
" Hide buffers when they are abandoned
set hidden
" Enable mouse usage (all modes)
set mouse=a
" make backspace work normal (indent, eol, start)
set backspace=2
" shortens messages to avoid 'press a key' prompt
set shortmess=atI
" don't bell or blink
set noerrorbells
set vb t_vb=
" Minimal number of screen lines to keep above
" and below the cursor.
set scrolloff=4

" how automatic formatting is to be done
set formatoptions=croq
" take indent for new line from previous line
set autoindent
" smart autoindenting
set smartindent

" Switch off automatic creation of backup files
set nobackup
set nowritebackup
set noswapfile

set termencoding=utf-8
set encoding=utf-8
set fileencodings=utf-8,cp1251

" Disable autoindent in VIM
nnoremap <F8> :setl noai nocin nosi inde=<CR>

" Use Ctrl+S to save file is edit and command modes
inoremap <c-s> <c-o>:w<cr>
nnoremap <c-s> :w<cr>

" Folding
" =======
" zM to fold everything
" zR to unfold everything
" za to toggle the current fold
" zA to recursively toggle the current fold

" Folding based on indentation:
set foldmethod=indent
set nofoldenable

" Explore
" =======

" Hide files and directories
let g:netrw_list_hide = '.pyc,.pyo,.o,.hg,.svn,.egg-info'

" NERDTree
" ========

" Shorter commands to toggle NERDTree display
nnoremap TT :NERDTreeToggle<CR>

" This option is used to specify which files the NERD tree
" should ignore.  It must be a list of regular expressions.
let NERDTreeIgnore=['\.pyc$', '\.egg-info$', '\.pyo$', '\.gz$', '\.zip$',
    \ '^__pycache__$', '\.o$', '^build$', '^dist$', '^env$']

" Autocmd
" =======

if has("autocmd")
    " Remove any trailing whitespace that is in the file
    autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif

    " Uncomment the following to have Vim jump to the last position when
    " reopening a file
    autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$")
        \ | exe "normal! g'\"" | endif