I found that when multiple tags exist for a given symbol, Vim can’t select the right tag .
I don’t know whether it’s always the truth , but at least I met this problem for several times.
To put my problem more clear, let’s say there are two classes : class A and class B in two different cpp files. Both of them defined a public member function called AddContext. Then somewhere else in the source code of the project , let’s denote it as place x, a instance of A called its memeber function AddContext.
You generate tags for the the project and go to place x and move the cursor under “AddContext” , and finally hit ctr-] .To your dismay, vim jump to the definition of B::AddContext rather than A::AddContext.
So is there any good vim practice to solve the problem as I momentioned ?
Use
or
This will help to solve your problem in the manual way. Ctags and Vim do not understand the context. So you have to determine it yourself.
Mapping those commands is a good way to deal with the problem.
You also can try 0scan plugin. It can help to choose desired place to jump in a more convenient way. Put your cursor on a symbol and press
0u.