How to navigate multiple ctags matches in Vim?
26,419
Solution 1
:tn[ext]
goes to the next tag, :tp[revious]
goes to the previous one. :ts[elect]
gives you a list to choose from.
:help tag-matchlist
for more fun and exciting things to try!
Solution 2
Use g]
instead of C-]
to get the list of all matches.
You might want to read :help g]
Solution 3
Adding the answer I was ultimately looking for in case it helps others:
g<C-]>
will jump to the tag if there's only one match and will present a list if there are multiple matches.
I've added this mapping to my .vimrc to make it do what I want by default:
nnoremap <C-]> g<C-]>
Author by
Sathish
Updated on July 08, 2022Comments
-
Sathish almost 2 years
I'm using Ctrl-] in Vim to navigate using Ctags. How do I navigate to alternate file if there are multiple matches?
Ex.
something.publish
in a codebase containing multiple occurrences ofpublish
:class Foo def publish end end class Bar def publish end end
-
alpha_989 almost 6 yearsVery cool.. As, it happens in
vim
very frequently..I actually accidentally pressed this.. and was wondering how I can get that functionality again :)