sublime text 用ctags插件实现方法定位

来源:互联网 发布:红蜘蛛教学软件介绍 编辑:程序博客网 时间:2024/04/26 11:04

针对网上流传的sublime下使用ctags做下修正,记录下供大家使用。

1.下载并解压ctags包中的ctags.exe, 并设置ctags.exe路径到系统环境变量

2.若没安装package control在这个插件的话,先安装它。

3.现在安装开始ctags的插件了,在package control中选择install package,搜索ctags就能找到ctags的插件,安装之。

到这里ctags就安装好
安装了,肯定无法使用,必须系统中有ctags才能用
官方说明如下安装ctags

OS X

If anyone is having trouble getting the CTags -R flag to work on OSX, you are probably using the stock CTags installation.

To get a proper copy of ctags, use one of the following options:

Using Homebrew: brew install ctags
Using MacPorts: port install ctags

Make sure that Sublime Text is using the right version of CTags:*
If 'which ctags' doesn't point at ctags in '/usr/local/bin', make sure you add '/usr/local/bin' to your PATH ahead of the folder that 'which ctags' reported.
Add or modify the 'export PATH=...' (e.g. in /.profile) to make the change permanent

Linux

To get a proper copy of ctags, use one of the following options:

In a terminal session: sudo apt-get install ctags 

Windows

Download the binary ctags.exe from Exuberant Ctags site.

Extract ctags.exe from the download zip to "C:\Program Files\Sublime Text 2" or any folder that within your PATH so CTags support for Sublime Text 2 can run it.

接着说一下使用:

要想ctags可以使用,先要在相应的项目目录生成.tags文件,比如我要在E:\www\php下生成。

首先cmd进入进入此目录,然后使用命令,会生成一个.tags 文件

ctags.exe -R -f .tags

 

接着你就可以发现目录下多了个文件

生成.tags文件后,这用sublime打开项目以后,就可以用下面方法跳转到函数声明

ctrl+t   ctrl+t   //鼠标在函数出执行,跳到函数处    ctrl+t   ctrl+b  //调回函数

当然用 ctrl+shift+鼠标左键 也可以跳到