diff --git a/vimrc b/vimrc index 712ee5f..0279d03 100644 --- a/vimrc +++ b/vimrc @@ -79,7 +79,7 @@ let mapleader = "," " }}} " tagbar {{{ - nnoremap t :TagbarToggle + nnoremap t :TagbarToggle " }}} " vim-airline {{{ @@ -92,50 +92,65 @@ let mapleader = "," " }}} " vim-trailing-whitespace {{{ - nnoremap w :FixWhitespace + nnoremap w :FixWhitespace " }}} " }}} -" Autocmds {{{ - autocmd FileType vim setlocal foldmethod=marker - autocmd FileType *.py setlocal foldmethod=indent | setlocal foldnestmax=2 -" }}} +augroup vimrc " {{{ + autocmd! + au BufNewFile,BufRead *.md set ft=markdown + au BufNewFile,BufRead bash_profile,bashrc set ft=sh + au BufNewFile,BufRead gitconfig set ft=gitconfig + au BufNewFile,BufRead rcrc set ft=sh + + au FileType vim setl foldmethod=marker + au FileType python setl foldmethod=indent + au FileType markdown,text setl formatoptions+=t | setl spell + au FileType gitcommit setl formatoptions+=t | setl spell | setl textwidth=72 +augroup END " }}} " Key mappings {{{ " split navigations and resizing - nnoremap - nnoremap - nnoremap - nnoremap - nnoremap :execute "resize " . (winheight(0) * 5/4) - nnoremap :execute "resize " . (winheight(0) * 4/5) - nnoremap :execute "vertical resize " . (winwidth(0) * 5/4) - nnoremap :execute "vertical resize " . (winwidth(0) * 4/5) + nnoremap + nnoremap + nnoremap + nnoremap + nnoremap :execute "resize " . (winheight(0) * 5/4) + nnoremap :execute "resize " . (winheight(0) * 4/5) + nnoremap :execute "vertical resize " . (winwidth(0) * 5/4) + nnoremap :execute "vertical resize " . (winwidth(0) * 4/5) " fast navigation of matchpairs ({[]}) - nnoremap % - vnoremap % + nnoremap % + vnoremap % " retain selection when indenting/unindenting in visual mode - vnoremap > >gv - vnoremap < <gv + vnoremap > >gv + vnoremap < <gv " case insensitive searching nnoremap // /\c nnoremap ?? ?\c " quickly exit insert mode - inoremap jk + inoremap jk " better navigation for wrapped lines noremap j gj noremap k gk " space opens/closes folds - nnoremap za + nnoremap za " turn off search highlight - nnoremap :nohlsearch + nnoremap :nohlsearch + + " switch between last two files + nnoremap + + " quickly change background + nnoremap bd :set background=dark + nnoremap bl :set background=light " }}} if filereadable(expand("~/.vimrc.local"))