我們用sublime幾乎都會首先安裝這個插件,這個插件是管理插件的功能,先安裝它,再安裝其他插件就方便了。
點擊sublime的菜單欄 view->show console ;現在打開了控制台, 這個控制台有上下兩欄, 上面一欄會實時顯示sublime執行了什么插件,輸出執行結果, 如果你安裝的某個插件不能正常運行,應該先在這里看看有沒有報錯。下面欄是一個輸入框,可以運行python代碼。我們輸入下面的代碼點擊回車運行, 就能安裝好package control了。
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
運行結束以后,記得重啟編輯器,就能在Preferences中看到 package control了。
如果上面的方法安裝不成功,可以這樣下載http://sublime.wbond.net/Package%20Control.sublime-package將下載后的Package Control.sublime-package直接放到 C:\Users\****\AppData\Roaming\Sublime Text 2\Installed Packages 中。
然后我們按住 ctrl+shift+p。此時會輸出一個輸入框, 輸入install。 選擇package contrl: install package 回車 ,需要稍定一會兒,右下角狀態欄會顯示正在連接的提示文字。 使用sublime時注意看右下角狀態欄,很多插件的提示信息都顯示在這里,這個狀態欄很小,初次使用的人都有可能沒有注意到它。
稍等一會兒后,它會出現一個插件列表, 你也可以在輸入框中輸入文字進行搜索插件。 搜索到自己想安裝的插件,再選擇它,回車。 就自動給你安裝好了。
如果要卸載插件, ctrl+shift+p 輸入 remove, 選擇package control:remove package 然后再選擇已安裝的插件, 回車即可卸載。
1.下載並解壓ctags包中的ctags.exe到系統環境路徑(默認壓縮在c:\windows\system32就好了)
2.若沒安裝package control在這個插件的話,先安裝它。這個在我的blog里有說明
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文件,比如我要在G:\AppData\web\seven\Cola下生成。
首先cmd進入對應的目錄,然后使用命令,會生成一個.tags 文件
ctags -R -f .tags
接着你就可以發現目錄下多了個文件
生成.tags文件后,這用sublime打開項目以后,就可以用下面方法跳轉到函數聲明
ctrl+t ctrl+t //鼠標在函數出執行,跳到函數處 ctrl+t ctrl+b //調回函數
當然用 ctrl+shift+鼠標左鍵 也可以跳到