Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ctags generate latest version gems

I use vim-rails and ctags for navigate of methods. For it I run ctags -R * in /home/***/.rvm/gems/ruby***/gems. But in this directory was many folders for one gems just different versions(for example activerecord v. 3.0.7/3.1.3/3.2.2/3.2.3). And when I try go to(ctrl+]) method I get to old version. How I can run ctags only with latest gems version?

like image 755
Eugene Avatar asked Apr 12 '12 19:04

Eugene


2 Answers

You can make bundler show the locations for the gems in the gemfile with

bundle show --paths

If you pipe this list into ctags I think you will have what you need.

bundle show --paths | xargs ctags -R

edit: Summarized in this blogpost: http://heim.no/VIM/2012/04/19/generate-ctags-for-all-bundled-gems-in-a-ruby-project/

like image 74
Andreas Heim Avatar answered Oct 15 '22 06:10

Andreas Heim


If you want to add tags for your project along with the gemfile tags you can use -a option to append so you can just do:

ctags -R -f .tags && bundle show --paths | xargs ctags -R -a -f .tags
like image 1
lacostenycoder Avatar answered Oct 15 '22 06:10

lacostenycoder