Wednesday, June 21, 2006

Vim : Dictionary completion facility

Dictionary completion facility is useful when you don't remember the spelling of a word. To make use of this, we must first set the dictionary option so that vim knows where the dictionary is. Following command does that.

:set dictionary-=/usr/share/dict/words dictionary+=/usr/share/dict/words

Now, start typing a word in insert mode.

astro<ctrl+x><ctrl+k>

This shows the first match in the dictionary. You can loop through the matches by using <ctrl+n> (for next) and <ctrl+p> (for previous).

Notes

To understand why the -= and +=, use this command
:help :set+=

No comments: