문제

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