$sudo dpkg -i sublime-text_build-3103_amd64.deb $subl --version Sublime Text Build 3103 $subl
#卸载
$dpkg -r sublime-text
Sublime Text3 注册码:
—– BEGIN LICENSE —– Michael Barnes Single User License EA7E-821385 8A353C41 872A0D5C DF9B2950 AFF6F667 C458EA6D 8EA3C286 98D1D650 131A97AB AA919AEC EF20E143 B361B1E7 4C8B7F04 B085E65E 2F5F5360 8489D422 FB8FC1AA 93F6323C FD7F7544 3F39C318 D95E6480 FCCC7561 8A4A1741 68FA4223 ADCEDE07 200C25BE DBBC4855 C4CFB774 C5EC138C 0FEC1CEF D9DCECEC D3A5DAD1 01316C36 —— END LICENSE ——
安装Package Control
cd ~/.config/sublime-text-3/Packages/
git clone https://github.com/wbond/package_control_channel.git Package\ Control或者打开sublime_text然后按快捷键ctrl+`(Esc下面那个键),在弹出的命令输入窗口输入下面信息回车即可:
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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://packagecontrol.io/' + 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)
重新启动SublimeText 3,你就可以发现在 Preferences 这个菜单下出现了菜单项 Package Control. 我们要安装 gosublime 插件,按住 Ctrl+Shift+p 会弹出一个会话框,在其中输入"install"后,输入"gosublime" 和 “go build",选中并回车,
打开 Package Settings - GoSublime - setting - Default,拷贝所有内容,然后粘贴到 Settings - User 中(这样的做法是为了保证你的修改不会被插件更新而重置,这插件更新很频繁)。
其中GOPATH 为你的程序的路径,里面要有个文件夹bin, pkg, src. $GOROOT 为go 安装目录
"env": {
"GOPATH": "/local/program/go",
"GOROOT": "/local/tools/go"
},
package main import ( "fmt" ) func main() { fmt.Printf("Hello, world.\n") }
在Tools - Build system - Go
让后Ctrl + B 选择go run 可在sublime终端看到结果.
你就可以发现在 Preferences 这个菜单下出现了菜单项 Package Control. 我们要安装 gosublime 插件,按住 Ctrl+Shift+p 会弹出一个会话框,在其中输入"install"后,输入"gosublime",选中并回车,会出现Sublime Text 2 不再支持GoSublime。
Sublime Text 2 is no longer supported by GoSublime
See https://github.com/DisposaBoy/GoSublime/blob/master/SUPPORT.md#sublime-text
If you have a *good* reason to not upgrade to Sublime Text 3,
discuss it here https://github.com/DisposaBoy/GoSublime/issues/689
有疑问加站长微信联系(非本文作者)
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)