vim: Add bindings around spell check
Add a spell-toggle, spelllang-cycle and spelllang-set binding.
This commit is contained in:
@@ -141,6 +141,10 @@ noremap! <C-H> <C-W>
|
|||||||
" Correct word with best/first suggestion.
|
" Correct word with best/first suggestion.
|
||||||
noremap <leader>c 1z=
|
noremap <leader>c 1z=
|
||||||
|
|
||||||
|
" Toggle spell, cycle and set spelllang
|
||||||
|
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
|
" Umlaute and sz in Insert and Command-line mode when spelllang is set to de
|
||||||
autocmd OptionSet spelllang call NewSpellLang(v:option_new, v:option_old)
|
autocmd OptionSet spelllang call NewSpellLang(v:option_new, v:option_old)
|
||||||
function! NewSpellLang(new_lang, old_lang)
|
function! NewSpellLang(new_lang, old_lang)
|
||||||
@@ -195,6 +199,16 @@ endif
|
|||||||
command! DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis
|
command! DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis
|
||||||
\ | wincmd p | diffthis
|
\ | wincmd p | diffthis
|
||||||
|
|
||||||
|
" Functions ####################################################################
|
||||||
|
" Toggle spell language between German and English
|
||||||
|
function! CycleSpellLang()
|
||||||
|
if (&spelllang == 'en')
|
||||||
|
set spelllang=de
|
||||||
|
else
|
||||||
|
set spelllang=en
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Autocommands #################################################################
|
" Autocommands #################################################################
|
||||||
" Highlight trailing whitespaces
|
" Highlight trailing whitespaces
|
||||||
" (https://vim.fandom.com/wiki/Highlight_unwanted_spaces)
|
" (https://vim.fandom.com/wiki/Highlight_unwanted_spaces)
|
||||||
|
|||||||
Reference in New Issue
Block a user