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:
@@ -52,7 +52,10 @@ map <leader>st :set spell=!&spell<CR>
|
||||
map <leader>sc :call CycleSpellLang()<CR>
|
||||
map <leader>ss :set spelllang=
|
||||
" 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)
|
||||
let &spellfile = $XDG_DATA_HOME . '/vim/spell/' . a:new_lang . '.utf-8.add'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user