From f8af2e2fa6548cb88390fb92f126d60c44343a41 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Fri, 24 Feb 2012 09:42:56 +0100 Subject: [PATCH] Updated go snippets, added json snippets --- UltiSnips/go.snippets | 26 +++++++++++++------------- UltiSnips/json.snippets | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 UltiSnips/json.snippets diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets index 3f0f85d..ea46931 100644 --- a/UltiSnips/go.snippets +++ b/UltiSnips/go.snippets @@ -5,7 +5,7 @@ # optional local name? snippet /^import/ "Import declaration" r import ( - "${1:package}" + "${1:package}" ) endsnippet @@ -17,7 +17,7 @@ endsnippet # Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle snippet /^cons/ "Constants declaration" r const ( - ${1:constant}${2/(.+)/ /}${2:type} = ${0:value} + ${1:constant}${2/(.+)/ /}${2:type} = ${0:value} ) endsnippet @@ -27,26 +27,26 @@ endsnippet snippet iota "Iota constant generator" b const ( - ${1:constant}${2/(.+)/ /}${2:type} = iota + ${1:constant}${2/(.+)/ /}${2:type} = iota ) endsnippet # statements snippet for "For loop" !b for ${1:condition}${1/(.+)/ /}{ - ${0:// body} + ${0:${VISUAL}} } endsnippet snippet forr "For range loop" !b for ${2:name} := range ${1:collection} { - ${0:// body} + ${0:${VISUAL}} } endsnippet snippet if "If statement" !b if ${1:condition}${1/(.+)/ /}{ - ${0:// body} + ${0:${VISUAL}} } endsnippet @@ -58,30 +58,30 @@ endsnippet snippet case "Case clause" !b case ${1:condition}: - ${0://body} + ${0:${VISUAL}} endsnippet snippet default "Default clause" !b default: - ${0://body} + ${0:${VISUAL}} endsnippet # functions snippet /^main/ "Main function" r func main() { - ${0:// body} + ${0:${VISUAL}} } endsnippet snippet /^meth/ "Method" r func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { - ${0:// body} + ${0:${VISUAL}} } endsnippet -snippet /^func/ "Function" r +snippet func "Function" b func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { - ${0:// body} + ${0:${VISUAL}} } endsnippet @@ -100,7 +100,7 @@ endsnippet snippet vars "Variables declaration" !b var ( - ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } + ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } ) endsnippet diff --git a/UltiSnips/json.snippets b/UltiSnips/json.snippets new file mode 100644 index 0000000..81e6561 --- /dev/null +++ b/UltiSnips/json.snippets @@ -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 +