Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this code open in vim:


When I do a Ctrl + ] with my cursor over the m, it brings me to its definition.

However, when I run :ts when my cursor is over the m, vim shows me this list of tags:

  # pri kind tag               file
> 1 F   f    mockGet           <filename>
               public function mockGet(...)

I run into this problem a lot (not just with this function). Any ideas what's happening?

share|improve this question
up vote 5 down vote accepted

The :help :tselect gives you the answer:

When [ident] is not given, the last tag name from the tag stack is used.

It uses the last jumped-to tag, not the word under the cursor. To insert that into the command-line, use Ctrl-R Ctrl-W.

share|improve this answer
Wow, I just spent 3 months using :ts as though it listed all the tags under my cursor. A case of RTFM. Thanks so much! – des4maisons Dec 14 '12 at 20:55
If you like that behavior, you can define your own command for it: command! Tselect execute 'tselect' expand('<cword>') – Ingo Karkat Dec 14 '12 at 21:11
I might just do that! – des4maisons Dec 14 '12 at 21:21
Also, try g] and g^]; they work like ^] (automatically using the keyword under/after the cursor), but use :tselect and :tjump (respectively) instead of :tag; :tjump is like :tselect, but skips the prompt if there is only one matching item. – Chris Johnsen Dec 15 '12 at 5:39

You must log in to answer this question.

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