Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
    
Multiposting is encouraged for questions that may be relevant to both areas, since different audiences can provide different input. – BinaryMisfit 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
3  
@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.stackexchange.com/questions/5790/…? – Nathan Fellman Sep 21 '09 at 8:41
up vote 4 down vote accepted

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

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

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 :)

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .