4

I've tried to generate the tag file by:

ctags -R * −−java−kinds=+mc

But when there are more than one matches, ctrl+] always jump to the wrong method definition in another class.

I know I can use :tjump to select if there's more than one option. But I hope there's better solution(if any)?

1
  • Have a look at :help tag-priority
    – Flimm
    Apr 11, 2014 at 22:39

2 Answers 2

14

In such cases, I'd recommend using g CTRL-] instead of CTRL-]. Like :tjump, this will list all available tag matches and query you instead of jumping to the first.

To make this the default, you can use this mapping:

:nnoremap <C-]> g<C-]>
2
  • Hi, do you have any clue on this issue?
    – georgexsh
    Nov 17, 2017 at 11:19
  • so i guess, there is no way for ctags to know. We must, therefore, list them and we do the choosing.
    – daparic
    Oct 30, 2018 at 3:09
-1

Neither ctags nor vim have the ability to guess what the correct tag is and there's no way around that beside :tjump or :tselect. :tag has a priority mechanism that you can read about in the doc but that's still pretty dumb.

Cscope is a little smarter but not that much.

Given that situation, listing possible targets for you to choose is the only sane and practical approach.

You must log in to answer this question.

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