vim/vimrc.d/autocommands.vim

55 lines
1.4 KiB
VimL
Raw Normal View History

2018-03-17 23:59:01 +00:00
" persistent folds
augroup AutoSaveFolds
autocmd!
autocmd BufWritePost *.* 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!
2018-03-17 23:59:01 +00:00
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
2018-03-17 23:59:01 +00:00
augroup linenumbering
autocmd!
2018-03-17 23:59:01 +00:00
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.
2018-03-17 23:59:01 +00:00
augroup END
augroup colorcolumns
autocmd!
2018-03-18 16:25:44 +00:00
autocmd WinEnter * call SetColorColumn()
autocmd WinLeave * setlocal colorcolumn=0
2018-03-17 23:59:01 +00:00
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
2018-03-17 23:59:01 +00:00
augroup END
2018-03-28 18:28:48 +00:00
" Open qfix after grepping
augroup qfixopen
autocmd!
autocmd QuickFixCmdPost *grep* botright cwindow
augroup END
2018-03-17 23:59:01 +00:00
" vim: foldmethod=marker