sublime3 for linux,SublimeText3配置共享(For Linux)

以下配置都在GoSublime插件的Settings - User 配置里面设置。

1.自动导包(go get -v code.google.com/p/go.tools/cmd/goimports):

“fmt_cmd”: [“goimports”],

2.自动编译包:

"comp_lint_enabled":true,

"comp_lint_commands": [

{"cmd": ["go", "install"]}

],

"lint_enabled": true,

"on_save": [{"cmd":"gs_comp_lint"}],

3.提示内置关键字:

"autocomplete_builtins": true,

4.收集的代码片段:

"snippets": [

{

"match": {"global": true, "pkgname": "."},

"snippets": [

{

"text":"type",

"title":"type struct {}",

"value":"type ${1:name} struct {\n\t$0\n}"

},{

"text":"type",

"title":"type interface {}",

"value":"type ${1:name} interface {\n\t$0\n}"

},{

"text":"var",

"title":"var struct {}",

"value":"var ${1:name} struct {\n\t$0\n}"

},{

"text":"map",

"title":"map[...]...",

"value":"map[${1:string}]${2:interface{}}"

},{

"text":"interface",

"title":"interface{}",

"value":"interface{}"

},{

"text":"if",

"title":"if err != nil {...}",

"value":"if ${1:err} ${2:!=} ${3:nil} {\n\t$0\n}"

},{

"text":"if",

"title":"if ret,ok := func(); ok {...}",

"value":"if ${1:ret,} ${2:ok} ${3::=} ${4:func()}; ${5:!ok} {\n\t$0\n}"

},{

"text":"break",

"title":"break",

"value":"break"

},{

"text":"continue",

"title":"continue",

"value":"continue"

},{

"text":"defer",

"title":"defer func()",

"value":"defer ${0:func()}"

},{

"text":"for",

"title":"for k,v := range func() {...}",

"value":"for ${1:k,}${2:v} := range ${3:func()} {\n\t$0\n}"

},{

"text":"switch",

"title":"switch ... {...}",

"value":"switch ${1:name} {\ncase ${2:v}:\n\t$3\ndefault:\n\t$0\n}"

}

]

}

],

5.代码导航和跳转(go get -v code.google.com/p/rog-go/exp/cmd/godef):

安装ST3插件:godef

设置工作目录(Settings - User):{“gopath”: “/home/guozi/works/goworks”}

设置快捷键(Key Bindings - Default):

[{ "keys": ["super+h"], "command": "godef" },

{ "keys": ["super+j"], "command": "jump_forward"},

{ "keys": ["super+k"], "command": "jump_back"} ]

6.常用快捷键:

ctrl+.+p 搜索包路径并插入到当前文件的import()

ctrl+shift+鼠标左键 代码导航跳转

ctrl+.+n 新建go源文件

super+h 高级导航跳转

7.其他扩展

terminal插件,在当前路径打开一个终端

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值