One can open a file at tag with:
vim -t <TAG>
However, if there are two tags with the same name, e.g. two variables of the same name in two different files, then the first one is opened.
How to order vim to open second one?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityYou can use :tnext
to jump to the next matching tag.
If you have four tags foo
, these commands will let you jump to each tag sequentially:
$ vim -t foo
:tn
:tn
:tn
You can use :tp[revious]
to jump to the previous tag, :tl[ast]
to jump to the last one, :tf[irst]
to jump to the first one.
And you can use :ts[elect]
to list all matching tags.
You can also use :ts
directly from your shell:
$ vim -c ':ts foo'
Or :[count]tag
if you already know which one you want. Assuming you want the fourth tag:
$ vim -c ':4tag foo'
See :help tag
.