Sublime Text 插件之ctags

Posted

##1. 安装ctags命令

$ brew install ctags

##2. subl安装ctags插件

按住快捷键 cmd+shift+p

输入 Package Control: Install Package

再输入 CTags 回车

注:如果以下的错

那么需要指定下ctags在subl的路定

{
  ...

  "command": "/usr/local/bin/ctags",
  "autocomplete": true
  ...
}

##3.建立索引

cmd+shift+p 选择 'Ctags:Rebuild Tags'

##4.快捷键(跳转至方法)

ctrl+shift+鼠标单击

到这一步,就可应用起来ctags!

##5.建立通用rails的命令

vi ~/.rvm/bin/ctags_rails

#!/bin/bash
/usr/local/bin/ctags -R -f .tags_gems .
#/usr/local/bin/ctags -R . $(bundle list --paths)

if [ -f ./Gemfile ]
  then
    /usr/local/bin/ctags -R -f .tags_gems $(bundle list --paths)
fi

chmod 777 ~/.rvm/bin/ctags_rails

这样以后每个rails项目都可以共用此命令

进入你的rails_app目录

ctags_rails  #建立索引

rails_app目录下会生成以下的文件,所以需要.gitignore排除出版本库!

$ git status
# On branch stable
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .tags
#   .tags_gems
#   .tags_sorted_by_file

此文章 短链接: http://dlj.bz/OdwhYC