Reputation: 1652
I've been using vim for ~1 year and absolutely love it. I feel at peace when I use vim. However, there's been one thing that I simply haven't figured out how to use effectively: tags.
I've googled around, browsed SO, etc. but I still haven't figured out how to use them. When I tried, I ended up with a bunch of tags folders scattered throughout my project, but still was unable to use the tags in a productive manner. I mainly work with Ruby on Rails, but I also work on some WordPress sites as well.
Can someone show me the right way to set up tags in vim when working on Rails projects?
Upvotes: 0
Views: 265
Reputation: 172520
I don't think there's much Ruby-specific about tags; you probably want to use a single tags database in the root of each individual project.
What I was struggling with the most is the automatic tags update; I simply forgot to run ctags -R
from the correct directory.
With the easytags.vim - Automated tag file generation and syntax highlighting plugin, that's handled automatically.
Just put
:set tags=./tags; " Search for tags upwards from the current file's directory.
:let g:easytags_dynamic_files = 1 " Also look for project-specific tags files.
in your ~/.vimrc
and create a tags file once in the project root:
$ cd /path/to/project
$ ctags -R .
Upvotes: 2