up vote 4 down vote favorite
2
share [g+] share [fb]

I am programming in C++ or Java. I want to use the Vim editor, and have heard that I can configure the Vim editor to be able to go:

  1. from an object to the definition
  2. from a function to the definition
  3. from a class name to the definition

Do we have any professional Vim-er that could tell me how exactly to configure Vim for that?

link|improve this question

75% accept rate
Multiposting is encouraged for questions that may be relevant to both areas, since different audiences can provide different input. – Diago Sep 19 '09 at 20:17
@Narek you should ask programming related questions on stackoverflow.com, check out this question: stackoverflow.com/questions/563616/vimctags-tips-and-tricks – Nick Dandoulakis Sep 19 '09 at 21:52
2  
@Nick it isn't really programming, it's how to configure the editor. – John T Sep 20 '09 at 15:29
@Diago, care to comment on that in meta.stackoverflow.com/questions/5790/…? – Nathan Fellman Sep 21 '09 at 8:41
feedback

2 Answers

up vote 4 down vote accepted

What you're referring to is tags I believe. Check here for section 29.1 - using tags.

link|improve this answer
correct, tags: vim.runpaint.org/navigation/navigating-tags – akira Sep 19 '09 at 22:08
feedback

You could look at the "code complete" plugin:


Update: Sorry I misunderstood your question, I think you are looking for ctags (and maybe cscope), I use ctags all the time but it works best for c, but I found it quite usable even for java.

I don't have a good tutorial right now but if you google for words like vim ctags tutorial you will find some usable links... (I hope anyway)

I also found this, that will create a index of all the java files under the src dir, for both ctags and cscope

ctags -R src/ & find src/ -name '*.java' > cscope.files &&  cscope -b

It work really nice under Linux, but if you are sitting on windows this also works under cygwin.


That was one really confusing answer... but maybe it could be usable anyway :)

link|improve this answer
thats not what the question was about, its not about insertin something at the current position, it is about navigating to the place where it is declared / defined – akira Sep 20 '09 at 20:25
feedback

Your Answer

 
or
required, but never shown

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