Skip to main content

Live Spellchecking Inside Vim

Did you ever want the capability of live spell-checking inside vi? Well, I did and I googled the subject and found this simple solution.

Assuming you have some sort of spell-checking software like ispell and agrep installed on your machine, you can use the "Engspchk" set of scripts for "multi-language", "on-the-fly spell checking." While the package documentation is pretty good, I will go ahead and narrow it down to a clean procedure.

1) Download the scripts, Unzip/untar them into your .vim directory.
cp engspchk.tar.gz $HOME/.vim/
cd $HOME/.vim/

tar zoxvf engspchk.tar.gz
2) Open your ~/.vimrc file and add this piece
" This piece enables live spellchecking inside Vim"
set nocp
if version >= 600
filetype plugin indent on
endif

set mouse=a
let g:spchkmouse = 1
let g:spchkautonext= 1
let g:spchkdialect = "usa"

3) Open a file using vi and enter ':helptags $HOME/.vim/doc'
4) To invoke the English spell-checker for a particular file, simply type '\ec'.
5) You can navigate through the spell-checking process using the following instructions:
* use leftmouse in text window to go to the next spelling error
irrespective of where the mouse was (allows one to skip over
spelling errors)
* use
leftmouse in the alternative spelling window to choose
the correct spelling and fix the word
* use
middlemouse in text window to go to next spelling error
based on where the mouse is
* use
rightmouse in text window to back up to the preceding
spelling error
* use
rightmouse in the alternative spelling window to fix all
such misspelled words
The three most relevant commands are:
\ec (engspchk's startup map)
\en (jump to next spelling error)
\ee (end engspchk)
The nice thing about this spellchecker is that it does not constantly hound you like others, it acts only when you invoke it.

Comments

BT08 said…
I noticed that 'set mouse=n' and 'set mouse=a' disable highlighting any piece of text using your mouse. One way to fix that is to change the command in your ~/.vimrc to 'set mouse=v'.

Popular posts from this blog

Online Storage Solutions

Problem: I often need to have some files readily available online so that I can access them from any computer. There are many ways to go about solving this problem and each comes with its set of shortcomings: Yahoo! Briefcase - 30MB limit Online storage services like Box.net, Xdrive, MediaMax - usually cost money; signing up is cumbersome Email to myself as an attachment - enough said there It's time to find a home-made solution. The solution I am about to suggest is intended for -- A *NIX user someone with access to a *NIX web server Solution: I am a linux user and I have user level access to a web server. The web server is configured such that the public does not have access to directory structure. So, I would need to write a script that copies my files to the web server and creates an index listing my files. Password protection of the storage would follow after that. Client Side: Use the following script to transfer file to server, make the file readable by public and execu...

Distribution of Wealth in the US

The rich get richer and the poor get poorer. I heard this statement quite a bit lately particularly in light of the sub-prime mortgage and general housing crisis in the US. The country has enjoyed significant economic prosperity and both Clinton and Bush boasted economic growth under their reign. Unfortunately, the beneficiaries of the economic boom are not people from all economic backgrounds, but rather the top 10%. To make things worse, Bush gave tax cuts mainly targeting the top 10%. Being more of a numbers guy, I always wanted showing the validity of the-rich-get-richer-n-the-poor-get-poorer statement. Thanks to Wikipedia , I have finally found it!! Both the mean and median net worth of families for the bottom 50% of the population has remained absolutely flat while the 75th-90th percentile see a decent growth and the top 10% enjoy the most appreciation on their net worth. So, if you factor in inflation, the-rich-get-richer-n-the-poor-get-poorer probably holds true. The g...

VP Picks and Chances of a President Dying in Office

After McCain picked a relatively unqualified and inexperienced Sarah Palin, many people gasped at the possibility of Palin having to take over the presidency in case something happens to McCain. I think McCain dying in office is overstated considering he appears healthy and fit despite the recurrence of a malignant melanoma. Plus, he has been getting great healthcare due to his status and will continue to do so whether or not he wins the presidency. That said, it would be nice to get numbers on chances of McCain's survival as a function of his age. Thankfully, that information was provided by Alex Burns at Politico . The odds of a 72-year-old man living four more years, or one full White House term, are better. But for a man who has lived 72 years and 67 days (McCain’s age on Election Day this year), there is between a 14.2 and 15.1 percent chance of dying before Inauguration Day 2013 , according to the Social Security Administration’s 2004 actuarial tables and the authoritati...