Thursday, January 31, 2008

gVim revisited

In previous post (here) I gave some hints about gVim and some scripts. The first serious update is on the spell-checking area. The new Vim 7.0 already includes a spell-checker. To activate it include the following in your ~/.vimrc file: set spell spl=<lang>, where <lang> is of [en,en_gb,en_us,de,de_20], see the complete documentation for more (here) and a nice quick reference chart here, from where I got inspired to add my own contribution for spell-checking.

First you need to install the dictd package:

#---
yum -y install dictd
#---


Then you can add the following to your ~/.vimrc file:

nmap <silent> <F2> :!dict -s exact -d gcide -m <C-R><C-W><CR>
nmap <silent> <F3> :!dict -s exact -d gcide <C-R><C-W><CR>



This line makes a dict query for word where your cursor is (if you press <F2>. It is just a match against on of the available dictionaries (see: dict --help for more details). This is useful for dictionaries that are not that updated and when the Vim spell-checker says that a word does not exist you can double-check it with <F2>.

The second variant, pressing <F3>, gives you the word definition.

I hope you enjoy it!

Related posts: Some scripts.

No comments: