Skip to content

Instantly share code, notes, and snippets.

@guycalledseven
Last active February 15, 2018 18:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guycalledseven/7b57acd539de79a6b4a0 to your computer and use it in GitHub Desktop.
Save guycalledseven/7b57acd539de79a6b4a0 to your computer and use it in GitHub Desktop.
My GoSublime .dot file
{
// you may set specific environment variables here
// e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
// in values, $PATH and ${PATH} are replaced with
// the corresponding environment(PATH) variable, if it exists.
"env": {"GOPATH": "c:/Users/Neven/Dropbox/Private/projects/go/workspace/", "PATH": "$GOPATH/bin:$PATH" },
"autocomplete_live_hint": true,
"fmt_tab_width": 4,
//"fmt_cmd": ["goimports"],
// enable comp-lint, this will effectively disable the live linter
"comp_lint_enabled": true,
// list of commands to run
"comp_lint_commands": [
// run `golint` on all files in the package
// "shell":true is required in order to run the command through your shell (to expand `*.go`)
// also see: the documentation for the `shell` setting in the default settings file ctrl+dot,ctrl+4
{"cmd": ["golint *.go"], "shell": true},
// run go vet on the package
{"cmd": ["go", "vet"]},
// run `go install` on the package. GOBIN is set,
// so `main` packages shouldn't result in the installation of a binary
{"cmd": ["go", "install"]}
],
// commands to run on (post) save - list of objects of the form {"cmd": "...", "args": {...}}
// Any TextCommand may be run. Supported GS commands include:
// gs_comp_lint - compile the pkg and report any errors
// "on_save": [],
"on_save": [
// run comp-lint when you save,
// naturally, you can also bind this command `gs_comp_lint`
// to a key binding if you want
{"cmd": "gs_comp_lint"}
],
// "on_save": [{
// "cmd": "gs9o_open", "args": {
// "run": ["sh",
// "go build . errors && go test -i && go test && go vet && golint ."],
// "focus_view": true
// }}],
// "on_save": [{
// "cmd": "gs9o_open", "args": {
// "run": ["sh",
// "go build . errors && go test -i && go test && go vet && golint ."],
// "focus_view": false
// }}],
// whether or not to include snippets in the auto-completion list
"autocomplete_snippets": true,
// whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
"autocomplete_tests": true,
// whether or not builtin types and functions should be shown in the auto-completion list
"autocomplete_builtins": true, // xxx
// whether or not to show an expanded(closure) version of func types in the auto-completion list
// e.g. `type Fun func(i int)`
// will result in two entries `Fun` and `Fun {}`
// expanding to `Fun` and `func(i) {...}` respectively
"autocomplete_closures": true, // xxx
// you may set this to a regexp which will be used to filter entries in the auto-completion list
// e.g. "autocomplete_filter_name": "^autogenerated_" will prevent any type or function
// whose name begins with "autogenerated_" from appearing in the auto-completion list
"autocomplete_filter_name": "",
// whether or not autocomplete should suggest possible imports when autocomplete fails to
// find a match.
// note: this feature only comes into effect when autocomplete was triggered after a dot, e.g. `fmt.|`
"autocomplete_suggest_imports": true, // xxx
// whether or not to show function call tip in the status bar
// the same can be achieved ctrl+dot,ctrl+space using an output panel
"calltips": true,
// whether or not to use named imports when the basename of the import path doesn't match the pkg name
// e.g. gosubli.me/go-foo would be imported as:
// import (
// foo "gosubli.me/go-foo"
// )
"use_named_imports": false,
// whether or not MarGo may automatically run `go install` for packages that are missing
// when you `import`, or `autocomplete` them
"autoinst": true,
// as an alternative to Sublime Text's snippet system you may add snippets to GoSublime's
// code-completion by adding them to your user settings in the same format as bellow.
//
// "snippets": [
// {
// "match": {"global": true}, // these snippets will only be presented in the global scope
// "snippets": [
// {"text": "init", "title": "func init()", "value": "func init() {\n\t$1\n}"}
// ]
// },
// {
// "match": {"local": true}, // these snippets will only be present in a function scope
// "snippets": [
// {"text": "print", "title": "print(...)", "value": "print($1)"},
// {"text": "println", "title": "println(...)", "value": "println($1)"}
// ]
// }
// ]
//
// you maybe add field markers ($1, $2, etc) to the `value` string to dictate where the cursor is place
// once a completion is expanded and where it's placed once you press tab afterwards.
// duplicate markers e.g f("...", $1, $1) will result in multiple cursors, one for each duplication.
"snippets": [],
"default_snippets": [
{
"match": {"global": false, "pkgname": ""},
"snippets": [
{"text": "package ${default_pkgname}", "title": "", "value": "package ${default_pkgname}\n\n$1\n"}
]
},
{
"match": {"global": true, "pkgname": "^main$"},
"snippets": [
{"text": "func main", "title": "func main {...}", "value": "func main() {\n\t$0\n}\n"}
]
},
{
"match": {"global": true, "pkgname": "."},
"snippets": [
{"text": "import", "title": "import (...)", "value": "import (\n\t\"$1\"\n)"},
{"text": "func", "title": "func {...}", "value": "func ${1:name}($2)$3 {\n\t$0\n}"},
{"text": "var", "title": "var (...)", "value": "var (\n\t$1\n)"},
{"text": "const", "title": "const (...)", "value": "const (\n\t$1\n)"},
{"text": "init", "title": "func init()", "value": "func init() {\n\t$1\n}"},
{
"text": "func http handler",
"title": "func(rw, req)",
"value": "func ${1:name}(rw http.ResponseWriter, req *http.Request) {\n\t$0\n}"
}
]
},
{
"match": {"global": true, "pkgname": ".", "has_types": true},
"snippets": [
{
"text": "func (*${typename})",
"title": "func (...) {...}",
"value": "func (${1:${typename_abbr}} ${2:*}${typename}) ${3:name}($4)$5 {\n\t$0\n}"
}
]
},
{
"match": {"local": true},
"snippets": [
{"text": "func", "title": "func{...}()", "value": "func($1) {\n\t$0\n}($2)"},
{"text": "var", "title": "var [name] [type]", "value": "var ${1:name} ${2:type}"}
]
}
],
// what 9o command to run when (super or )ctrl+dot,ctrl+b us pressed
// e.g. ["go", "build"]
// the 9o command ^1 recalls the last command you ran manually
// see 9o help(ctrl+9 "help") for more details about what commands are supported
"build_command": ["^1"],
"auto_complete_triggers": [ {"selector": "source.go", "characters": "."} ],
// exclude files with the listed prefixes from the file browsing palette (ctrl+dot,ctrl+m)
"fn_exclude_prefixes": [".", "_"],
// Automatically set the syntax file for the specificed file extensions to `GoSublime: HTML`
// `GoSublime: HTML` files are html files with the template delimiters `{{` and `}}` tailored to
// Go templates (text/template, html/template)
// (`.gohtml` files are automatically set by the syntax definition)
"gohtml_extensions": [".html.go"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment