LoginSignup
51

More than 5 years have passed since last update.

macにctagsインストールして、vimでRailsのソースコード読む

Posted at

インストール

$ brew install ctags

そのままだと動かないので、aliasはる
参考: https://gist.github.com/nazgob/1570678

.bashrc
alias ctags="`brew --prefix`/bin/ctags"
$ . ~/.bashrc

railsアプリのルートでタグ作成
参考: http://qiita.com/joker1007/items/9c114a37560d6a29fe81

$ ctags --langmap=RUBY:.rb --exclude="*.js"  --exclude=".git*" -R .

準備完了。後はvimで

# ジャンプしたい箇所にカーソルを当てて
Ctrl + ]

# 戻る
Ctrl + t

# 該当結果が複数ある場合に、リスト表示
:tjump

# 明示してジャンプ(例:Userモデルにジャンプ)
:tag User

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
51