I'm using codex for generating tags file but vim does not follow tags such as

$ <$> . <*>

with ctrl-] it only works if I manually call tag

:tag $

Is it a bug? or there is something that I don't know


  • Does it work if you highlight the text in visual mode first?
    – Tumbler41
    Dec 14, 2016 at 22:51
  • yes it does, that's weird. thanks it makes it easier
    – raoof
    Dec 15, 2016 at 5:07

1 Answer 1


ctrl-] uses the word under the cursor, (as opposed to a WORD) which means that any punctuation is excluded.

From :h word:

A word consists of a sequence of letters, digits and underscores, or a sequence of other non-blank characters, separated with white space (spaces, tabs, ). This can be changed with the 'iskeyword' option. An empty line is also considered to be a word.

So your options are:

  1. Select it with visual mode first to tell it explicitly what you want to search for, or
  2. Change the mapping to use a WORD (which is any white space separated characters).

You can do so with the following mapping in your vimrc:

nnoremap <silent><C-]> :exe "tag ".expand('<cWORD>')<CR>
  • nnoremap: create a non-recursive, normal mode mapping
  • <silent><C-]>: map CTRL + ] and do it without echoing anything
  • :exe: execute the following string as a command
  • "tag ": use the tag command
  • .expand('<cWORD>'): append the WORD under the cursor to the tag command
  • <CR>: a carriage return. Simply executes the command.

Please note that doing this will not allow you to use tags in the vim help files as they surround their tags with ||!

See :h word, :h WORD for more info.

  • 4
    Nice. I was curious how to solve that question. Additionally, this mapping can be put in ~/.vim/ftplugin/<extension>.vim - which will make it only available in certain file type only - so help will be still working (or use autocommand for FileType)
    – grodzik
    Dec 15, 2016 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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