3

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?

3

You 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.

  • Vim freaking rules. – romainl Sep 19 '16 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.