vim/vimrc.d/autocommands.vim

55 lines
1.4 KiB
VimL

" persistent folds
augroup AutoSaveFolds
autocmd!
autocmd BufWinLeave ?* mkview
autocmd BufWinEnter ?* silent loadview
augroup END
" fix higlight problems such as vertical-align etc
augroup VimCSS3Syntax
autocmd!
autocmd FileType css setlocal iskeyword+=-
augroup END
" Show trailing whitepace and spaces before a tab:
augroup whitespaceerrors
autocmd!
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
augroup END
" automatically reload if color scheme file written
" augroup coloreload
" autocmd!
" autocmd BufWritePost customred256.vim so $MYVIMRC
" augroup end
augroup linenumbering
autocmd!
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set number relativenumber
autocmd WinEnter * :set number relativenumber
autocmd WinLeave * set norelativenumber
autocmd CmdlineLeave * :set number relativenumber
" see 'mapping nnoremap :' for setting norelative number.
augroup END
augroup colorcolumns
autocmd!
autocmd WinEnter * call SetColorColumn()
autocmd WinLeave * setlocal colorcolumn=0
augroup END
" Automatically reload .vimrc if chanaged
augroup myvimrc
autocmd!
autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
" Open qfix after grepping
augroup qfixopen
autocmd!
autocmd QuickFixCmdPost *grep* botright cwindow
augroup END
" vim: foldmethod=marker