# For the vim folks

**URL:** <https://www.ruby-forum.com/t/for-the-vim-folks/163802>\
**Category:** Ruby\
**Created:** [March 25, 2009, 1:58am UTC](https://www.ruby-forum.com/t/for-the-vim-folks/163802 "2009-03-25T01:58:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 25, 2009, 1:58am UTC](https://www.ruby-forum.com/t/for-the-vim-folks/163802/1 "2009-03-25T01:58:33Z")

</div>

I’ve been using vi/vim since '97 for various quick edits and  
administration tasks, but have only recently considered using it to  
replace Netbeans as my ruby editor of choice. One thing I find  
extremely useful in both Netbeans and Eclipse is the Ctrl+Click “Go to  
definition” feature, where you can ctrl+click on a class or method and  
it will take you to the definition.

Now, I’ve played with exuberant ctags and rails.vim, and it’s close,  
but no cigar. Here’s what I want: by default in Netbeans and Eclipse,  
you can ctrl+click a local method or class in your local rails  
project, but you can also ctrl+click on things defined in gems or in  
the system libraries that are coded in Ruby. Netbeans for example  
parses all ruby files in the default system paths and makes them  
navigable for you. If there are multiple files that define a method,  
it will present you with a list and allow you to choose between them.

How can one accomplish this within vim? If it can be done, I may be  
able to make the jump full time.

Thanks,  
John

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 25, 2009, 9:43am UTC](https://www.ruby-forum.com/t/for-the-vim-folks/163802/2 "2009-03-25T09:43:10Z")

</div>

On Wed, Mar 25, 2009 at 6:24 AM, John W.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How can one accomplish this within vim? If it can be done, I may be  
> able to make the jump full time.

Hello John,

Take a look at the ‘tags’ option in vim:  
:h tags-option

It lets you define a set of tag files vim will use for tag lookups  
(Ctrl-]).  
So you could define something similiar to the following in a ruby  
ftplugin:  
setl tags=./tags;/Users/lasitha,/usr/local/ruby1.9/lib/tags

The semicolons define un upward search. ‘:h path’ for more on the  
syntax.

The key to solving your problem though is to add some absolute paths  
to global tag files for the ruby source (not shown above) and gems.

When generating these tag files, it helps to use an excludes file to  
weed out things like rdoc files. I keep ‘.ctags-excludes’ files in  
the relevant directories and use them with:  
ctags --exclude=@.ctags-excludes -R .

And lastly i use some bash aliases for gem install and update to make  
sure the tag files are immediately regenerated.

Hope that helps you get converted (it’s worth it :).

Oh, btw - a vim-on-rails ML was created recently:  
[http://groups.google.com/group/vim-on-rails](http://groups.google.com/group/vim-on-rails)

solidarity,  
lasitha.

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 25, 2009, 4:57pm UTC](https://www.ruby-forum.com/t/for-the-vim-folks/163802/3 "2009-03-25T16:57:50Z")

</div>

On Wed, Mar 25, 2009 at 4:39 AM, lasitha [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > it will present you with a list and allow you to choose between them.  
> > So you could define something similiar to the following in a ruby ftplugin:  
> > ctags --exclude=@.ctags-excludes -R .
> 
> And lastly i use some bash aliases for gem install and update to make  
> sure the tag files are immediately regenerated.
> 
> Hope that helps you get converted (it’s worth it :).
> 
> Oh, btw - a vim-on-rails ML was created recently:  
> [http://groups.google.com/group/vim-on-rails](http://groups.google.com/group/vim-on-rails)

Thanks very much…this should get me going in the right direction. I  
appreciate the help!

John
