Updated go snippets, added json snippets

This commit is contained in:
Holger Rapp 2012-02-24 09:42:56 +01:00
parent 45b1d09d53
commit f8af2e2fa6
2 changed files with 32 additions and 13 deletions

View File

@ -34,19 +34,19 @@ endsnippet
# statements # statements
snippet for "For loop" !b snippet for "For loop" !b
for ${1:condition}${1/(.+)/ /}{ for ${1:condition}${1/(.+)/ /}{
${0:// body} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet forr "For range loop" !b snippet forr "For range loop" !b
for ${2:name} := range ${1:collection} { for ${2:name} := range ${1:collection} {
${0:// body} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet if "If statement" !b snippet if "If statement" !b
if ${1:condition}${1/(.+)/ /}{ if ${1:condition}${1/(.+)/ /}{
${0:// body} ${0:${VISUAL}}
} }
endsnippet endsnippet
@ -58,30 +58,30 @@ endsnippet
snippet case "Case clause" !b snippet case "Case clause" !b
case ${1:condition}: case ${1:condition}:
${0://body} ${0:${VISUAL}}
endsnippet endsnippet
snippet default "Default clause" !b snippet default "Default clause" !b
default: default:
${0://body} ${0:${VISUAL}}
endsnippet endsnippet
# functions # functions
snippet /^main/ "Main function" r snippet /^main/ "Main function" r
func main() { func main() {
${0:// body} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet /^meth/ "Method" r snippet /^meth/ "Method" r
func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
${0:// body} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet /^func/ "Function" r snippet func "Function" b
func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
${0:// body} ${0:${VISUAL}}
} }
endsnippet endsnippet

19
UltiSnips/json.snippets Normal file
View File

@ -0,0 +1,19 @@
snippet s "String" b
"${1:key}": "${0:value}",
endsnippet
snippet n "number" b
"${1:key}": ${0:value},
endsnippet
snippet a "Array" b
[
${VISUAL}$0
],
endsnippet
snippet o "Object" b
{
${VISUAL}$0
},
endsnippet