Sublime Text安装go语言开发

1、安装Sublime Text

官方地址:http://www.sublimetext.com/3

2、下载插件

打开地址Gosublime :https://github.com/DisposaBoy/GoSublime,下载zip。(我尝试git clone下载多次,都失败了,最终选择zip包)

3、自动补全功能

Perferences–Browse Packages…,进入Gosublime:
把第二部的包解压到这里,名称重命名GoSublime。

进入GoSublime目录,我的目录是C:\Users\HIGHGO\AppData\Roaming\Sublime Text 3\Packages\GoSublime

1、在src目录下创建margo目录;
2、拷贝src/margo.sh/extension-example/extension-example.go文件到margo目录下;
3、拷贝margo文件夹(所有文件和目录)到src/margo.sh/vendor目录下;
4、重新打开sublime text3

Gosublime配置

Perferences–Package Settings–Gosublime–Settings - User

{
    "env": {
        "GOPATH": "/data",
        "GOROOT": "/usr/local/go",
        "PATH": "$GOROOT:$GOPATH:$GOROOT/bin",
    },
    "gscomplete_enabled": true,
    "fmt_enabled": true,
    "fmt_tab_indent": false,
    "fmt_tab_width": 4,

    "autocomplete_snippets": true,
    "autocomplete_tests": true,
    "autocomplete_builtins": true,
    "autocomplete_closures": true,
    "autocomplete_suggest_imports": true,
    "calltips": true,
    "use_named_imports": true,
    "autoinst": true,
    "ipc_timeout": 1,
    "fmt_cmd": ["goimports"],
    "on_save": [
        {"cmd": "gs_comp_lint"},
        {"cmd": "goimports"}
    ],
    "lint_enabled": true,
    "linters": [
        {"cmd": ["go", "run"]}
    ],
    "comp_lint_enabled": true,
    "comp_lint_commands": [
        {"cmd": ["go", "install"]}
    ],
}

Ctrl+功能键,比如CTRL+b是内置命令行

Perferences–Package Settings–Gosublime–Key Bindings - Default

{
		"keys": ["ctrl+q"],
		// "keys": ["super+.", "super+h"],
		"command": "gs_doc",
		"args": {"mode": "hint"},
		"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
}

验证

输入package和fmt是否有补全功能,按下Ctrl+B是否显示命令行

参考地址:https://blog.csdn.net/CodyGuo/article/details/89199597

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值