From: Samir Benmendil Date: Wed, 5 Feb 2014 01:39:33 +0000 (+0100) Subject: vim: add function to switch spelllang X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/eaba3abef798780da5126d319c316da8a06d477a?ds=inline vim: add function to switch spelllang --- diff --git a/vim/vimrc b/vim/vimrc index ffd3796..841be45 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -89,8 +89,21 @@ syntax on set spelllang=en_gb " list of accepted languages set dictionary=spell " list of dictionary files for keyword completion -" toggle spell-checking -map :set nospell!:set nospell? +" Spell Check http://tex.stackexchange.com/a/52932 +let b:myLang=0 +let g:myLangList=["nospell","en_gb","en_us","de","fr"] +function! ToggleSpell() + let b:myLang=b:myLang+1 + if b:myLang>=len(g:myLangList) | let b:myLang=0 | endif + if b:myLang==0 + setlocal nospell + else + execute "setlocal spell spelllang=".get(g:myLangList, b:myLang) + endif + echo "spell checking language:" g:myLangList[b:myLang] +endfunction +map :call ToggleSpell() +imap :call ToggleSpell() if has("autocmd") au Filetype *