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

const char *keyword)$/;" f file:<br />

ArchiveEntry pg_backup_archiver.c<br />

/^ArchiveEntry(Archive *AHX,$/;" f<br />

AssignDumpId common.c<br />

/^AssignDumpId(DumpableObject *dobj)$/;"<br />

f<br />

Usage 1: Navigate to particular function definition by specifying the<br />

function name using :ta<br />

In the example below, :ta main will take you to the main function definition<br />

inside the mycprogram.c<br />

# <strong>vim</strong> mycprogram.c<br />

:ta main<br />

By using this facility you can navigate to any function definition by specifying<br />

the function name.<br />

Usage 2. Navigating to the function definition from ‘function call’<br />

using CTRL + ]<br />

When the cursor is over the function call, then press CTRL + ] to go to the<br />

function definition.<br />

In the following example, when the cursor is anywhere within the word<br />

ssh_xcalloc, pressing CTRL + ] will take you to the ssh_xcalloc function<br />

definition.<br />

# <strong>vim</strong> mycprogram.c<br />

av = ssh_xcalloc(argc, sizeof(char *));<br />

Note: If the ctags couldn’t find that function, you’ll get the following<br />

message in the Vim status bar at the bottom: E426 tag not found ssh_xcalloc<br />

42

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

Saved successfully!

Ooh no, something went wrong!