I am programming in C++ or Java. So I want to use Vim editor, because it is very flexible. I have heard that I can configure the Vim editor to be able to go
- from object to the definition
- from function to the definition
- from class name to the definition
Do we have any professional Vim-er that could tell me exactly how to configure Vim for that? Thanks in advance.
P.S. In case readers will consider this question is not connected with programming, I would say that this is improving speed of programming. So it is a help to the programmer. So please don’t close this question.
EDIT: Also I would like to know how vim works with code completion and can vim hint the list of methods that are available for the certain object? If yes, then I would like to know how to configure these options too?
What you’re looking for is ctags and tags/TAGS files. Ctags (I recommend Exuberant Ctags) is a program which scans source files for identifiers and creates a file indexing them. You can then use ^] to jump to the definition for the tag under the cursor.
There may be some additional details needed to tell vim how to find the tags file; I’m not sure off-hand what they are. But that’s the general idea – run ctags over your source code and then use ^].
Alternatively, you may wish to look at GNU Global. It’s a bit more sophisticated. But ctags will accomplish what you’ve described.