Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've installed taglist and nerdtree plugins, and I wonder if there's way to quickly find the location where some function is defined, just as what Control and pressing function name in Eclipse does? Help would be appreciated!

share|improve this question

2 Answers 2

up vote 2 down vote accepted

vim comes with ctags support built in. If you have a tags file make sure it can be found by vim by adding it to the tags variable (check if the default works first though)

:set tags+=/path/to/tags

Then you can use :tselect SOME_FUNC to list the file locations. You might only need to type the first characters of the function name and could use TAB to complete.

share|improve this answer
    
Thanks for quick reply.I've make a new directory /usr/include/tags for tags and put set tags+=/usr/include/tags into .vimrc,and seem still need something? –  SpawnST May 13 '10 at 3:26
    
@SpawnST does your '/usr/include/tags' directory hold any 'tags' files? –  akira May 13 '10 at 4:54
1  
You need to generate the tags file launching ctags *.c from the directory containing your source files. See man ctags and also this stackoverflow question for more tips on vim & ctags: stackoverflow.com/questions/563616/vimctags-tips-and-tricks –  mrucci May 13 '10 at 5:07
    
@akira,nope,what's tags files,how can i generate them? –  SpawnST May 13 '10 at 5:10
    
@mrucci,OIC,I'll check that,thank you. –  SpawnST May 13 '10 at 5:11

You can also put the cursor somewhere in the function name and press Ctrl-]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.