How can I generate a good ctags file for a rails project ? One that includes all the gems, ruby libs and sorts them in the right order (like when you search for “Rails” it doesn’t go to the airbrake gem or whatever)

I'm using this right now, but I don't like it for the reason mentioned above:

ctags --tag-relative -Rf.git/tags.$$ --exclude=.git --exclude=*.html --exclude=tmp --exclude=public --exclude=app/assets --languages=-javascript,js,sql,html `bundle show --paths` $MY_RUBY_HOME .
有帮助吗?

解决方案 2

So it turns out the better option (better than ctags) is either Robe for Emacs or a combination of vim + tmux + vmux + pry (to get show-source and edit).

irb-config is an interesting example of vim setup.

其他提示

Neither Vim nor ctags understand or can be taught to understand your code and/or your thoughts. If you want to jump to a different tag than the first matching one in your tags file, use the proper commands:

:tselect foo        " list all tags 'foo'
:tselect /foo       " list all tags containing 'foo'
g]                  " list all tags matching the word under your cursor

Also, note that you can make "your" ctags command a little shorter by whitelisting filetypes:

ctags --tag-relative -Rf.git/tags.$$ --exclude=.git --exclude=tmp --exclude=public --exclude=app/assets --languages=ruby `bundle show --paths` $MY_RUBY_HOME .
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top