Reputation: 3216
I want to follow from
class ApplicationController < ActionController::Base
to
/home/slavik/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0.rc6/lib/action_controller/base.rb
and look to commented reference of possible usage this class
Upvotes: 3
Views: 794
Reputation: 14051
ripper-tags sounds great but is having issues as of today (November 2013). I ended up using exuberant ctags (with a few tricks)
1- install exuberant ctags. If you're using osx, this article shows a little trick: http://www.runtime-era.com/2012/05/exuberant-ctags-in-osx-107.html
2- If you only wish to include the ctags for the files in your directory only, run this command in your directory:
ctags -R
This will create a "tags" file for you.
3- If you wish to include the ctags for your gems (this has been really helpful for me with RubyMotion and local gems that I have developed), do the following:
ctags --exclude=.git --exclude='*.log' -R * `bundle show --paths`
credit: https://coderwall.com/p/lv1qww (Note that I removed the -e option which generates tags for emacs instead of vim)
4- Add the following line to your ~/.vimrc
set autochdir
set tags+=./tags;
(Why the semi colon: http://vim.wikia.com/wiki/Single_tags_file_for_a_source_tree )
5- Go to the word you'd like to follow and hit ctrl+]
. hit ctrl+o
to go back (https://stackoverflow.com/a/53929/226255)
Upvotes: 1
Reputation: 17174
There are couple of issues with ctags which has pretty old and ugly parser:
I would recommend better project ripper-tags based on official Ruby parser called Ripper which is included in Ruby. It is fast and accurate: https://github.com/tmm1/ripper-tags
You can also install gem-ripper-tags to have tags files automatically generated after gem installation: https://github.com/lzap/gem-ripper-tags
Please note that these days, August 2013, there is a big refactoring of ripper-tags which can lead to change of command line options or gem-ripper-tags interface. If things are not working, update both gems in couple of days and read help screen to learn new options.
Upvotes: 2
Reputation: 20724
Yes, there is at least one way. You can use exuberant ctags in combination with the tags option of Vim. Pratically, you have to execute ctags in the /home/slavik/.rvm/gems/ruby-1.9.2-p290/gems/ like :
ctags -R tags
See ctags --help
if you want to dig into tags customization. Then you have to add this file to your tags path in vim. Using something like the following:
:set tag+=/home/slavik/.rvm/gems/ruby-1.9.2-p290/gems/tags
In order to understand how powerful this vim features is take a look at Browsing_programs_with_tags.
Upvotes: 3