1

I have a fairly small Javascript project, and when I run ctags -R it seems to generate at least some tags. I get a tags file (no extension?) in the root folder, and when I run wc -l tags it says 8214 tags.

However, Ctrl+] never finds any tags, even ones in the same file. Right now, I'm using the supergf plugin for similar functionality but I'm also using Tagbar and most of the functions are showing up empty or not at all. (e.g. void function(?,?,?,?))

What am I doing wrong? I also have tern-js installed.

Thanks

6
  • Do you see an error message when you type Ctrl-]? Vim will report an error if it can't find a tags file or can't find a tag in the tags file.
    – garyjohn
    Aug 17, 2015 at 16:16
  • Yeah, it just says "tag not found", no matter what tag I'm searching for. Aug 17, 2015 at 16:21
  • OK, then try the command :echo tagfiles() and see if the file names it reports include the one you built. If the names are relative, execute :pwd to be sure the current working directory is what you think it is.
    – garyjohn
    Aug 17, 2015 at 16:56
  • You might also try searching for a tag from the command line using the :tag command. I'm wondering if your iskeyword setting conflicts with the ctags program's idea of what a word is, which would interfere with the ability of Ctrl-] to grab the right tag.
    – garyjohn
    Aug 17, 2015 at 16:59
  • When you write "I also have tern-js installed.", is it only the node module or the node module and tern_for_vim? That plugin provides — among other features — a "jump to definition" command (:TernDef) that is a lot smarter than :tag so… with that plugin installed you don't really need ctags to navigate your JavaScript project. Anyway, do you get anything when doing :echo taglist(".")?
    – romainl
    Aug 17, 2015 at 18:55

3 Answers 3

1

You should check your current directory to see if its the same as your tags file

:pwd

If not just

:cd /to/dir/which/contains/yourtagfile

and try again using tags.

Please check this response for ways to set searching directories for tag files

0

You may want to try the taglist plugin. It works perfectly for me.

1
  • Somehow, it's even worse...it doesn't find any of my functions at all. Aug 17, 2015 at 16:22
0

Have you tried storing the tags file in the top-level directory of your project and adding this line to your .vimrc?

set tags=tags

Also be sure to start (g)vim in that top-level directory. CTRL+N and CTRL+P should work.

Your Answer

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

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