3f1cdba799
Added update_plugins.py which can fetch new plugins from GitHub. New plugins added: zencoding, vim-indent-object, taglist, nginx.vim
107 lines
1.9 KiB
Text
107 lines
1.9 KiB
Text
# Snippets for Go
|
|
|
|
# when to abbriviate and when not?
|
|
# b doesn't work here, because it ignores whitespace
|
|
# optional local name?
|
|
snippet /^import/ "Import declaration" r
|
|
import (
|
|
"${1:package}"
|
|
)
|
|
endsnippet
|
|
|
|
snippet /^package/ "Package declaration" r
|
|
// Package $1 provides ...
|
|
package ${1:main}
|
|
endsnippet
|
|
|
|
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
|
|
snippet /^cons/ "Constants declaration" r
|
|
const (
|
|
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
|
|
)
|
|
endsnippet
|
|
|
|
snippet /^con/ "Constant declaration" r
|
|
const ${1:name}${2/(.+)/ /}${2:type} = ${0:value}
|
|
endsnippet
|
|
|
|
snippet iota "Iota constant generator" b
|
|
const (
|
|
${1:constant}${2/(.+)/ /}${2:type} = iota
|
|
)
|
|
endsnippet
|
|
|
|
# statements
|
|
snippet for "For loop" !b
|
|
for ${1:condition}${1/(.+)/ /}{
|
|
${0:${VISUAL}}
|
|
}
|
|
endsnippet
|
|
|
|
snippet forr "For range loop" !b
|
|
for ${2:name} := range ${1:collection} {
|
|
${0:${VISUAL}}
|
|
}
|
|
endsnippet
|
|
|
|
snippet if "If statement" !b
|
|
if ${1:condition}${1/(.+)/ /}{
|
|
${0:${VISUAL}}
|
|
}
|
|
endsnippet
|
|
|
|
snippet switch "Switch statement" !b
|
|
switch ${1:expression}${1/(.+)/ /}{
|
|
case${0}
|
|
}
|
|
endsnippet
|
|
|
|
snippet case "Case clause" !b
|
|
case ${1:condition}:
|
|
${0:${VISUAL}}
|
|
endsnippet
|
|
|
|
snippet default "Default clause" !b
|
|
default:
|
|
${0:${VISUAL}}
|
|
endsnippet
|
|
|
|
# functions
|
|
snippet /^main/ "Main function" r
|
|
func main() {
|
|
${0:${VISUAL}}
|
|
}
|
|
endsnippet
|
|
|
|
snippet /^meth/ "Method" r
|
|
func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
|
|
${0:${VISUAL}}
|
|
}
|
|
endsnippet
|
|
|
|
snippet func "Function" b
|
|
func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
|
${0:${VISUAL}}
|
|
}
|
|
endsnippet
|
|
|
|
# types and variables
|
|
snippet map "Map type" !b
|
|
map[${1:keytype}]${2:valtype}
|
|
endsnippet
|
|
|
|
snippet : "Variable declaration :=" !b
|
|
${1:name} := ${0:value}
|
|
endsnippet
|
|
|
|
snippet var "Variable declaration" !b
|
|
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
|
endsnippet
|
|
|
|
snippet vars "Variables declaration" !b
|
|
var (
|
|
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
|
)
|
|
endsnippet
|
|
|
|
# vim:ft=snippets:
|