14.06.2014 Views

vim 101 hacks

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Buyer: xiujuan lu (luxiujuan@gmail.com)<br />

Transaction ID: 85W16630AD8515549<br />

Vim <strong>101</strong> Hacks<br />

www.thegeekstuff.com<br />

Download and Use a Pre-defined Thesaurus<br />

Instead of defining your own custom thesaurus, download and use the predefined<br />

famous moby thesaurus as shown below.<br />

$ wget<br />

http://www.gutenberg.org/dirs/etext02/mthes10.zip<br />

$ unzip mthes10.zip<br />

Archive: mthes10.zip<br />

inflating: aaREADME.txt<br />

inflating: roget13a.txt<br />

inflating: mthesaur.txt<br />

Use mthesaur.txt as the thesaurus file. It is quite large and you would get<br />

more than 50 related words for each word.<br />

Add the following line to .<strong>vim</strong>rc to specify the location of the mthesaur.txt<br />

thesaurus file.<br />

$ <strong>vim</strong> ~/.<strong>vim</strong>rc<br />

set thesaurus+=/home/jsmith/mthesaur.txt<br />

How can a programmer use thesaurus feature in <strong>vim</strong>?<br />

This can be very helpful for programmers. For example, a PHP programmer<br />

can create a php-functions file with the following lines and specify this as<br />

thesaurus file inside the ~/.<strong>vim</strong>rc.<br />

$ <strong>vim</strong> /home/jsmith/php-functions.txt<br />

148

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!