Skip to content

Instantly share code, notes, and snippets.

@aybabtme
Created January 23, 2014 17:54
Show Gist options
  • Save aybabtme/8583451 to your computer and use it in GitHub Desktop.
Save aybabtme/8583451 to your computer and use it in GitHub Desktop.
{
// 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": "$HOME/gocode"
},
// Your shell. e.g. on Linux and OS X, if your shell bash:
// you may set it to ["/bin/bash", "--login", "-c", "$CMD"]
// it's useful to pass the --login argument in order for it run your ~/.bashrc etc.
// otherwise environment variables may not be seen by Sublime Text and therefore GoSublime
//
// If set, commands are passed to it instead of the Python default which for *nix is usually
// /bin/sh which in most cases is not what you want
//
// the special entry "$CMD" is replaced by the actual command
"shell": ["/usr/local/bin/zsh", "--login", "$CMD"],
// by default fmt'ing is done by margo using `fmt_tab_intent` and `fmt_tab_width` (above)
// you may use a command of your choosing by setting `fmt_cmd`
// e.g. ["goimports"]
// the command will be passed, to its stdin, the contents of the file
// it must output the new file contents
"fmt_cmd": ["goimports"],
// Whether or not comp lint is enabled (this might conflict with gslint)
"comp_lint_enabled": true,
// The list of commands that comp-lint will run (in the order specified)
// each entry contains a map of:
// cmd: a list containing the command and its args
// shell: whether or not use the $shell to run this command
// if you don't need $shell features then don't set this.
// global: whether or not commands like go install should affect the system globally
// by default the environment variable GOBIN is set to ($TEMPDIR/GoSublime/bin
// which in the installation of commands via comp-lint going there instead of into
// one of your GOPATHs.
// setting this to true, you can e.g automate the actual installation of your commands
// additionally, for `shell` and `global` if the value is not `true` then it's assumed to be false
"comp_lint_commands": [
{"cmd": ["go", "vet"]},
{"cmd": ["golint *.go"], "shell": true},
{"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": [
{"cmd": "gs_comp_lint"}
],
// 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": [
{
"match": {"global": true},
"snippets": [
{"text": "func Test", "title": "func Test {...}", "value": "func Test_$0(t *testing.T) {\n\t$1\n}\n"}
]
},
{
"match": {"global": true},
"snippets": [
{"text": "func Bench", "title": "func Bench {...}", "value": "func Bench_$0(b *testing.B) {\n\t$1\n}\n"}
]
},
],
// 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