Updated go snippets, added json snippets
This commit is contained in:
parent
45b1d09d53
commit
f8af2e2fa6
@ -5,7 +5,7 @@
|
|||||||
# optional local name?
|
# optional local name?
|
||||||
snippet /^import/ "Import declaration" r
|
snippet /^import/ "Import declaration" r
|
||||||
import (
|
import (
|
||||||
"${1:package}"
|
"${1:package}"
|
||||||
)
|
)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ endsnippet
|
|||||||
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
|
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
|
||||||
snippet /^cons/ "Constants declaration" r
|
snippet /^cons/ "Constants declaration" r
|
||||||
const (
|
const (
|
||||||
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
|
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
|
||||||
)
|
)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@ -27,26 +27,26 @@ endsnippet
|
|||||||
|
|
||||||
snippet iota "Iota constant generator" b
|
snippet iota "Iota constant generator" b
|
||||||
const (
|
const (
|
||||||
${1:constant}${2/(.+)/ /}${2:type} = iota
|
${1:constant}${2/(.+)/ /}${2:type} = iota
|
||||||
)
|
)
|
||||||
endsnippet
|
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
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ endsnippet
|
|||||||
|
|
||||||
snippet vars "Variables declaration" !b
|
snippet vars "Variables declaration" !b
|
||||||
var (
|
var (
|
||||||
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
||||||
)
|
)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
19
UltiSnips/json.snippets
Normal file
19
UltiSnips/json.snippets
Normal 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user