vim: Remove german umlaut mappings

As I started to type on the international US layout I don't need any
extra bindings for special characters in vim.

Move the update of `spellfile` into xdg.vim, as it was the only
remaining body of `NewSpellLang()` and fits thematically.
This commit is contained in:
2022-08-25 04:27:51 +02:00
parent 794293aa81
commit 9ce1cd236b
2 changed files with 5 additions and 27 deletions

View File

@@ -51,33 +51,6 @@ noremap <leader>[S [S1z=<C-O>
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`
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! <buffer>' key value
endfor
elseif (a:old_lang == 'de')
for key in keys(mappings)
execute 'unmap! <buffer>' key
endfor
endif
endfunction
" Jump through jump table but center
noremap <Tab> <Tab>zz

View File

@@ -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