EDIT: Sorry I misread your question.
Either you use a plugin that permits you to select an overload among others. That's one of the reasons I wrote lh-tags. In all cases, you'll need to know by yourself what is the type of your variable. This is not perfect, but more than enough for me. You still have :pselect
, but I've always found it clumsy.
You could also rely on more clever tools. I'm thinking about http://langserver.org/ .
I wonder whether it wouldn't be a better solution. The advantage of LangServer is we can expect it to be able to rely on a tool specialized for the languages we work with.
If you want to stick to a pure ctags solution, first prefer universal-ctags. Then, if you want to automatically select the right function, you'll have to write some non trivial code.
- First, you'll need to extract the type of the variable. You can start with the
gd
command to goto to the variable definition. If it fails, you could run (universal-!)ctags on the current file and make sure to ask for variable declarations/definitions.
- With this new info, you should be able to find the line where the variable is defined. (*)
- There, you'll have to analyse the line found to extract the type:
mbase
-- in other languages we have other kind of declarations.
- Eventually you can
filter(taglist(funcname), 'v:val.class == "mbase"')
, and jump by yourself to this entry (there is everything needed to behave as a tag jump in lh-tags) -- the exact dictionary key to analyse may depend on the language.
Be aware that if your language permits stuff like
myvar = new SomeType1();
if (...)
myvar = new SomeOtherType2();
or even
myvar = new SomeType1();
...
myvar = new SomeOtherType2();
or worse
myvar = f(g());
Good luck with ctags in order to extract the exact type. We have other problems when the language supports overriding.
(*) NB: In lh-cpp, I have a series of functions (that I'll like to refactor) I use to extract the type of a C++ variable. It be may adapted to your language. In lh-dev I have an undocumented API to run ctags on the fly on the current file to extract some specific information without modifying the current tag database -- that I'm also likely to refactor.