diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index a413a1d..4dc7de3 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -51,33 +51,6 @@ noremap [S [S1z= map st :set spell=!&spell map sc :call CycleSpellLang() map ss :set spelllang= -" Umlaute and sz in Insert and Command-line mode when spelllang is set to `de` -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' - - let mappings = { - \ 'ae': 'ä', - \ 'Ae': 'Ä', - \ 'oe': 'ö', - \ 'Oe': 'Ö', - \ 'ue': 'ü', - \ 'Ue': 'Ü', - \ 'sz': 'ß', - \ } - if (a:new_lang == 'de') - for [key, value] in items(mappings) - execute 'map! ' key value - endfor - elseif (a:old_lang == 'de') - for key in keys(mappings) - execute 'unmap! ' key - endfor - endif -endfunction " Jump through jump table but center noremap zz diff --git a/.config/vim/xdg.vim b/.config/vim/xdg.vim index a50a034..1db7e4a 100644 --- a/.config/vim/xdg.vim +++ b/.config/vim/xdg.vim @@ -44,6 +44,11 @@ if !isdirectory($XDG_DATA_HOME . '/vim/spell') call mkdir($XDG_DATA_HOME . '/vim/spell', 'p') endif let &spellfile = $XDG_DATA_HOME . '/vim/spell/' . &spelllang . '.utf-8.add' +augroup xdg_spellfile + au! + au OptionSet spelllang let &spellfile = + \ $XDG_DATA_HOME . '/vim/spell/' . v:option_new . '.utf-8.add' +augroup end set runtimepath-=~/.vim runtimepath^=$XDG_CONFIG_HOME/vim set runtimepath-=~/.vim/after runtimepath+=$XDG_CONFIG_HOME/vim/after