Sublime Text 2 using Ctags to implement function jumps

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

About the introduction of Ctags, here is not introduced, we can search to understand the next. (Ubuntu under test, other environments not tested)
1. Install the ctags as follows:

Curl-o http://prdownloads.sourceforge.net/ctags/ctags-5.8.tar.gz
Tar xzvf ctags-5.8.tar.gz
CD ctags-5.8
./configure
Make
sudo make install

2. Add the ~/.ctags file with the following content:

–langdef=go
–langmap=go:.go
–regex-go=/func ([t]+ ([^)]+))? [T]+ ([a-za-z0-9_]+)/2/d,func/
–regex-go=/var[t]+ ([a-za-z_][a-za-z0-9_]+)/1/d,var/
–regex-go=/type[t]+ ([a-za-z_][a-za-z0-9_]+)/1/d,type/

3. Install the sublime Text 2 ctags plugin:
Address: Https://github.com/SublimeText/CTags

4. Create a. tags file in your project directory:

yourihua@ubuntu:~/workplace/rhino$ ctags-r-F. tags
yourihua@ubuntu:~/workplace/rhino$

You can also use ctrl+shift+p rebuild a bit of tags.

Well, now you can try, here are the common commands:

Commands Listing

Command Key Binding Alt Binding Mouse Binding
Rebuild_ctags Ctrl+t Ctrl+r
Navigate_to_definition Ctrl+t ctrl+t Ctrl+> Ctrl+shift+left_click
Jump_back Ctrl+t ctrl+b ctrl+< Ctrl+shift+right_click
Jump_back to_last_modification Ctrl+t ctrl+m
Show_symbols Alt+s
Show_symbols Multi Alt+shift+s
Show_symbols suffix Ctrl+alt+shift+s

Reference article:
Http://www.gravitywell.co.uk/blog/post/how-to-set-up-ctags-for-sublime-text-editor-2
Http://go-wise.blogspot.com/2011/09/using-ctags-with-go.html
Max Os needs attention:
Http://gmarik.info/blog/2010/10/08/ctags-on-OSX

2013-07-14
Add:
Add Setting–user configuration, convenient Sublime text 2 right-click Rebuild Tags. As follows:
{
"Command": "/usr/local/bin/ctags-r-F tags"
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.