Wrap all vim autocmds in a group to improve reload stability

This commit is contained in:
Michael Campagnaro 2021-03-05 14:58:38 -05:00
parent 1a63209c3c
commit 6f266e9f1c

33
vimrc
View File

@ -272,7 +272,10 @@ set cursorcolumn
" And make sure those directories exist before opening vim. " And make sure those directories exist before opening vim.
set backup set backup
set backupcopy=yes set backupcopy=yes
:au BufWritePre * let &bex = '.' . strftime("%Y-%m-%d-%T") . '.bak' augroup backupCmds
autocmd!
autocmd BufWritePre * let &bex = '.' . strftime("%Y-%m-%d-%T") . '.bak'
augroup END
set writebackup " Make buckup before overwriting the current buffer. set writebackup " Make buckup before overwriting the current buffer.
" Keep undo history across sessions by storing it in a file. The undo save " Keep undo history across sessions by storing it in a file. The undo save
@ -603,7 +606,12 @@ nmap <leader>ha <Plug>GitGutterStageHunk
nmap <leader>hh :GitGutterToggle<cr> nmap <leader>hh :GitGutterToggle<cr>
nmap [h <Plug>GitGutterNextHunk nmap [h <Plug>GitGutterNextHunk
nmap ]h <Plug>GitGutterPrevHunk nmap ]h <Plug>GitGutterPrevHunk
autocmd BufWritePost * GitGutter " Update marks on save
augroup gitGutterPluginCmds
autocmd!
" Update marks on save
autocmd BufWritePost * GitGutter
augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SYNTASTIC " SYNTASTIC
@ -829,36 +837,36 @@ endif
" working... " working...
augroup vimrc_bugs augroup vimrc_bugs
au! autocmd!
au Syntax * syn match MyBugs /\v<(FIXME|BUG|DEPRECATED):/ autocmd Syntax * syn match MyBugs /\v<(FIXME|BUG|DEPRECATED):/
\ containedin=.*Comment,vimCommentTitle \ containedin=.*Comment,vimCommentTitle
augroup END augroup END
hi def link MyBugs Bugs hi def link MyBugs Bugs
augroup vimrc_notes augroup vimrc_notes
au! autocmd!
au Syntax * syn match MyNotes /\v<(IDEA|NOTE|QUESTION|WARNING|IMPORTANT):/ autocmd Syntax * syn match MyNotes /\v<(IDEA|NOTE|QUESTION|WARNING|IMPORTANT):/
\ containedin=.*Comment,vimCommentTitle \ containedin=.*Comment,vimCommentTitle
augroup END augroup END
hi def link MyNotes Notes hi def link MyNotes Notes
augroup vimrc_notices augroup vimrc_notices
au! au!
au Syntax * syn match MyNotices /\v<(WARNING|IMPORTANT):/ autocmd Syntax * syn match MyNotices /\v<(WARNING|IMPORTANT):/
\ containedin=.*Comment,vimCommentTitle \ containedin=.*Comment,vimCommentTitle
augroup END augroup END
hi def link MyNotices Notices hi def link MyNotices Notices
augroup vimrc_annotated_todo augroup vimrc_annotated_todo
au! autocmd!
" This was a major pain in the ass to get working... " This was a major pain in the ass to get working...
au Syntax * syn match cTodo /@\S\+/ autocmd Syntax * syn match cTodo /@\S\+/
\ containedin=.*Comment,vimCommentTitle \ containedin=.*Comment,vimCommentTitle
augroup END augroup END
augroup vimrc_annotated_notes augroup vimrc_annotated_notes
au! autocmd!
au Syntax * syn match cTodo /#\+ .\+$/ autocmd Syntax * syn match cTodo /#\+ .\+$/
\ containedin=.*Comment,vimCommentTitle \ containedin=.*Comment,vimCommentTitle
augroup END augroup END
@ -930,7 +938,8 @@ function! SilentBuild()
endfunction endfunction
" Show results window the moment the async job starts " Show results window the moment the async job starts
augroup vimrc augroup asyncPluginCmds
autocmd!
autocmd User AsyncRunStart call asyncrun#quickfix_toggle(g:quickfix_window_height, 1) autocmd User AsyncRunStart call asyncrun#quickfix_toggle(g:quickfix_window_height, 1)
augroup END augroup END