0. 安装ST3(Sublime Text 3) 和 Package Control
a.修改hosts,添加一行(该死的GFW):
50.116.34.243 sublime.wbond.net
b.安装两个库先:
$go get github.con/nsf/gocode
$go get github.com/slene/margo(很多参考文章里面提到的github.com/DisposaBoy/MarGo已经不存在了)
$mv $GOPATH/bin/margo $GOPATH/bin/Margo
c.安装Sublime Text 3(build 3065)
http://www.sublimetext.com/3
d.ST3(Sublime Text 3)里面:
control+`
输入下面这行,回车安装Package Control:
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
1、GoSublime
a.shift+commond+p
ip(Package Control:Install Package)4.Godef (added 20141208 代码跳转,margo的super+.,super+g只能跳转到定义处,不能跳转回来.可自定义快捷键跟LiteIDE一样的热键,保持一致的使用习惯)
说明: http://blog.buaa.us/godef-plugin-for-sublime-released/
a. 安装过程参考 https://github.com/buaazp/Godef
b.Preferences->Package Settings->Godef->Settings-User
{
"gopath": "/usr/local/Cellar/go/1.1.2/libexec:/Users/wenke/go"
}
c.Preferences->Package Settings->Godef->Key Bindings-Default
[
{ "keys": ["shift+super+j"], "command": "godef" }
]
d.Preferences->Package Settings->Godef->Key Bindings-User
[
{ "keys": ["alt+super+right"], "command": "jump_forward"},
{ "keys": ["alt+super+left"], "command": "jump_back"},
]