Alex Rivera | Logout

Vim: Difficulty setting up ctags. Source in subdirectories don't see tags file in project root

Asked 2011-02-16T14:16:58.147
74

I'm trying to get setup with (exuberant) ctags on Vim today and am having difficulty getting it to work properly. I generate my ctags file on the command line with with:

cd myproj
ctags -R

This puts the tags file in myproj root. However, Vim only seems to read from this tags file when I'm working on source that reside in root. As I navigate to deeper directories, if I try to jump to a tag using <C-]>, I get:

E433: No tags file
E426: tag not found: MyClassName

I've verified that MyClassName does have a tag in the tags file, it's just that Vim doesn't see it. Can someone please explain how to configure Vim to reference the root's tags file?

Thanks.

Edit
Report

1 Answer

147

add this to .vimrc file set tags=tags;/

This will check the current folder for tags file and keep going one directory up all the way to the root folder.

So you can be in any sub-folder in your project and it'll be able to find the tags files.

answered 2011-02-16T16:27:56.923

Your Answer