Correcting spelling mistakes automatically
------------------------------------------------
You can customise vi/vim according to your requirement using the ~/.vimrc file. You can even make vim learn the spellings of words also.
Suppose, you identified that usually commint some typoes ( teh for the, for example). We will see how to teach vi/vim to correct these mistakes automatically.
Open the file ~/.virmrc file and key in the contents as below and save the file.
iab teh the
The syntax is as follows.
ia incorrect_word correct_word
A plug-in for vim is available from http://www.vim.org/ , which is actually a collection of common mistakes we make, it is quite big repository which we can make use of.
Installing the autocorrect.tar plug-in
------------------------------------------
wget -O autocorrect.tar http://www.vim.org/scripts/download_script.php?src_id=9900
$ tar xf autocorrect.tar
Edit the ~/.vimrc file and key in the contents as below
$ vi ~/.vimrc
:source ~/autocorrect.vim
Note: If you dont want the auto correction permenently, you can add the source while in a vim session as below
:source
If you want to temporarly stop abbreviation for a word, you can use ' : uab teh' while in vim
:uab teh
Thursday, April 2, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment