Note: This entry has been restored from old archives.
I’ve been using an external spell-checking plugin for vim for some time now. Today I upgraded my systems to vim-7.0, to do this on Debian Sarge (stable) add to
# Backports - A "Pin" in preferences file required is to prefer backport pkg. deb http://www.backports.org/debian sarge-backports main
And add to
Package: vim Pin: release a=sarge-backports Pin-Priority: 999 Package: vim-common Pin: release a=sarge-backports Pin-Priority: 999
Then do an
apt-get update and
apt-get install vim.
vim and do
:help spell for full documentation! The first thing you’ll want to know to play with it is turning it on:
setlocal spell spelllang=en_gb (for real English, surprisingly it also has en_au). It will highlight unknown words, for suggestions sit the cursor on the word and type
I didn’t see anything immediately obvious in the doco for simple on-off toggling of the spell-check mode. So I knocked up this little bit of vim-code to toggle the spellcheck with Ctrl-i (more obvious combos already taken) for the current buffer (i.e. on/off is maintained independently for each buffer). This
is now^W^Wwas in my
" Toggle spell checking for the current buffer function ToggleSpell() if &l:spell setlocal nospell else setlocal spell spelllang=en_gb endif endfunction map
:call ToggleSpell() imap :call ToggleSpell() i
It’s a good thing that vim can spell, because I shore can’t.
A quick scan of some vim doco moved me to simplify the above toggle to:
" Set spelling language. set spelllang=en_gb " Toggle spell checking for the current buffer with Ctrl-i map
:setlocal invspell imap :setlocal invspell i
Silly me, there is a slight problem with binding C-i in vim.