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 />

Fig: Jump to a specific function quickly<br />

Usage 3: Jump to a function defined in another source file<br />

When you encounter a function in a source file that is defined elsewhere, and<br />

you want to go to the function definition, you can do this via two different<br />

methods.<br />

Method 1: If you had the ctags generated for that file, when the cursor is in<br />

the function call pressing CTRL + ] will take you to the function definition.<br />

The tag list window will show the tags for that newly opened file.<br />

Method 2: Open another file also in the same Vim session. Vim will update<br />

the tag list window with the information about that file. Search for that<br />

function name in the tag list window, and press on that function name,<br />

and Vim will take you to the function definition.<br />

Usage 4: Viewing the prototype/signature of functions or variables.<br />

Press ’space’ when the cursor is in the function name or in the variable name<br />

in the tag list window to show the prototype (function signature) of it in the<br />

Vim status bar as shown below.<br />

47

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

Saved successfully!

Ooh no, something went wrong!