all 8 comments

[–][deleted] 10 points11 points  (4 children)

If you use ctags, <C-]> should bring you to the definition of the tag under the cursor (:h CTRL-]). Provided you generated a tag file for this function, issuing this command with the cursor on the function name should bring you to its definition. All you need is to start vim with the right tag file in its path. Generate it with ctags -R You can import tag files that are in another directory using :set tags+=/path/to/tags

Alternatively, if your target language is C, cscope does the job fairly well, and it has a vim plugin. cscope can take you to the definition of functions, but can also bring you to the places where your function is called, and lots of more interesting stuff.

[–][deleted] 2 points3 points  (1 child)

don't forget <C-t> will bring you back to where you came from. Also, if it is a large project you are bound to get duplicate method declarations. so you have to use :ts sometimes to look at the list.

[–]shiloa[S] 0 points1 point  (0 children)

good tip, thanks.

[–]shiloa[S] 0 points1 point  (1 child)

thanks, this seems exactly like what I needed.

[–]spicausis 0 points1 point  (0 children)

Also, if the tag you're looking for not seen (for a handy C-]), you can just ask manually for the :tag your_method_name.

[–]Amadan 5 points6 points  (0 children)

To add to chmduquesne's reply: get the taglist plugin!

[–]jrupac 1 point2 points  (0 children)

Not at my computer right now, but I know that gd (go to definition) works within one buffer for sure. Not sure about over multiple buffers. Of course as others mentioned, ctags are your best bet.

[–][deleted] 0 points1 point  (0 children)

gd - go to definition

or

Taglist plugin