14.06.2014 Views

vim 101 hacks

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Transaction ID: 85W16630AD8515549<br />

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

www.thegeekstuff.com<br />

Hack 45. Access Unix Man page for Functions from<br />

Vim<br />

From the Vim editor, press K on the word for which you want to read the man<br />

page.<br />

K<br />

To access another section man page give {n}K. For example, to access the 2 nd<br />

section of the man page, do the following.<br />

2K<br />

Example: Sleep is a command, as well as library routine. So from a C program<br />

if you attempt to view this man page, then you need to use 3K<br />

Customize Man page Lookup (For example, Change to Perldoc)<br />

To look up things other than Unix man pages, specify a different keywordprg.<br />

For example, if you are a Perl programmer, you will be using the perldoc<br />

command often for reading information about a function. So, set the<br />

following in Vim editor.<br />

:set keywordprg=perldoc\ -f<br />

After the above setting, when you press K on a function name it will open the<br />

perldoc instead of the Unix man page.<br />

83

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

Saved successfully!

Ooh no, something went wrong!