Sunday, November 29, 2009

vim 7

vim 7
Ben has installed a testing version of vim. To use it, just type vim7 instead of vim (or gvim7 instead of gvim). One nice thing about this new version is spell checking. Below are some of Ben's notes on how to use spell checking with vim7.

add this to your .vimrc:
if has("spell")
" turn spelling on by default
set spell

" toggle spelling with F4 key
map :set spell!:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)

" they were using white on white
highlight PmenuSel ctermfg=black ctermbg=lightgray

" limit it to just the top 10 items
set sps=best,10
to have a personal wordlist, make a directory called ~/.vim/spell
you can manually add things your personal wordlist (~/.vim/spell/en.latin1.add):
printf( (so printf is invalid, but printf( is ok)
ArrayList/= (the /= means always match case)
focussed/! (the /! says treat this as a misspelling)
if you manually add to your wordlist, you need to regenerate it:
:mkspell! ~/.vim/spell/en.latin1.add
some useful keys for spellchecking:
]s - forward to misspelled/rare/wrong cap word
[s - backwards

]S - only stop at misspellings
[S - in other direction

zG - accept spelling for this session
zg - accept spelling and add to personal dictionary

zW - treat as misspelling for this session
zw - treat as misspelling and add to personal dictionary

z= - show spelling suggestions

:spellr - repeat last spell replacement for all words in window

No comments: