Linux under Sublime Text 3 installation godef for code jump/jump back to __linux

Source: Internet
Author: User
Tags sublime text git clone

Jumps in the Gosublime plug-in use Gsdoc, which only skips members and functions (such as FMT) that come out of the subcontract name. PRINTLN), Very inconvenient

Later found Godef This plug-in, you can achieve any object jump (instantaneous cool fly, in addition, I also added a jump back to the method)

Http://blog.buaa.us/godef-plugin-for-sublime-released/This is the release document of the GODEF author (thank you here)

The following records the installation process and the problems encountered

1. Install godef to $GOPATH/bin

Go get-v github.com/rogpeppe/godef
CD xxx/godef # target directory go
install

2. Install Guru to $GOPATH/bin

# go get-v Golang.org/x/tools/cmd/guru
# Because of the wall so use the mirror on GitHub to manually copy past
mkdir $GOPATH/src/golang.org/x-P
CD $ gopath/src/golang.org/x
git clone https://github.com/golang/tools.git
CD./tools/cmd/guru Go
Install

3. Install Godef

git clone https://github.com/buaazp/Godef.git ~/.config/sublime-text-3/packages/godef
# or in sublime Package Control Search Godef Installation

4. Configure Godef.sublime-settings

Not required by default, can be found automatically during installation, sample content:

{
    "goroot": "/xxx",
    "Gopath": "/xxx"
}

But because my Gopath contains $HOME directories that are not found Godef and guru (Modify Godef configuration or $GOPATH can)

This problem was found by the log printed by the Sublime console (Ctrl + ') (godef.py used Os.path.isfile () to verify that the file exists)

(or use the godef:https://github.com/chinaran/godef.git I submitted the patch in step 3rd)

5. Custom Jump shortcut keys

The default is {"Keys": ["G", "D"], "command": "Godef"} (g and D in order)

I changed it to ["Alt+q"] (see a person's preference)

For the jump back, the original author did not provide this function, so I implemented a (similar to the Ctags plug-in Jump_prev)

The default is {"Keys": ["G", "H"], "command": "Godef_prev"} (G and h in order)

I changed it to ["Alt+s"] (you can use the Godef:https://github.com/chinaran/godef.git I submitted the patch)

Related Article

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.