vim: Wrap autocmds in augroups
To prevent the piling up of autocommands when reloading the vimrc, wrap all autocommands in groups.
This commit is contained in:
@@ -94,4 +94,7 @@ let g:netrw_liststyle=3
|
|||||||
" TermDebug
|
" TermDebug
|
||||||
|
|
||||||
" Have source view to the side of the splits of debugger and program
|
" Have source view to the side of the splits of debugger and program
|
||||||
autocmd SourcePost termdebug.vim let g:termdebug_wide = 1
|
augroup termdebug_settings
|
||||||
|
au!
|
||||||
|
autocmd SourcePost termdebug.vim let g:termdebug_wide = 1
|
||||||
|
augroup end
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ map <leader>st :set spell=!&spell<CR>
|
|||||||
map <leader>sc :call CycleSpellLang()<CR>
|
map <leader>sc :call CycleSpellLang()<CR>
|
||||||
map <leader>ss :set spelllang=
|
map <leader>ss :set spelllang=
|
||||||
" Umlaute and sz in Insert and Command-line mode when spelllang is set to `de`
|
" Umlaute and sz in Insert and Command-line mode when spelllang is set to `de`
|
||||||
autocmd OptionSet spelllang silent call NewSpellLang(v:option_new, v:option_old)
|
augroup spelllang_set
|
||||||
|
au!
|
||||||
|
autocmd OptionSet spelllang silent call NewSpellLang(v:option_new, v:option_old)
|
||||||
|
augroup end
|
||||||
function! NewSpellLang(new_lang, old_lang)
|
function! NewSpellLang(new_lang, old_lang)
|
||||||
let &spellfile = $XDG_DATA_HOME . '/vim/spell/' . a:new_lang . '.utf-8.add'
|
let &spellfile = $XDG_DATA_HOME . '/vim/spell/' . a:new_lang . '.utf-8.add'
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,15 @@
|
|||||||
" Terminal
|
" Terminal
|
||||||
if (has('nvim'))
|
if (has('nvim'))
|
||||||
" Disable spellcheck
|
" Disable spellcheck
|
||||||
|
augroup terminal_no_spellcheck
|
||||||
|
au!
|
||||||
autocmd TermOpen * setlocal nospell
|
autocmd TermOpen * setlocal nospell
|
||||||
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" change cursor shape depending on mode
|
" change cursor shape depending on mode
|
||||||
|
augroup cursor_shape_by_mode
|
||||||
|
au!
|
||||||
if (has('nvim'))
|
if (has('nvim'))
|
||||||
" Beam when exiting
|
" Beam when exiting
|
||||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||||
@@ -38,9 +43,13 @@ else
|
|||||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
" Custom bindings when debugging
|
" Custom bindings when debugging
|
||||||
autocmd SourcePost termdebug.vim tnoremap <Esc> <C-\><C-n>
|
augroup termdebug_bindings
|
||||||
|
au!
|
||||||
|
autocmd SourcePost termdebug.vim tnoremap <Esc> <C-\><C-n>
|
||||||
|
augroup END
|
||||||
|
|
||||||
" Highlight word under cursor
|
" Highlight word under cursor
|
||||||
augroup highlight_current_word
|
augroup highlight_current_word
|
||||||
|
|||||||
Reference in New Issue
Block a user