1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2015-03-14 20:02:10 +00:00
parent d195ccb777
commit 2cb073a57d
73 changed files with 1098 additions and 525 deletions

View File

@ -38,7 +38,7 @@ endsnippet
# case
snippet case "case ...:"
case ${1:value}:
${0}
${0:${VISUAL}}
endsnippet
# constant
@ -70,8 +70,7 @@ endsnippet
# default case
snippet default "default: ..."
default:
${0}
${0:${VISUAL}}
endsnippet
# defer
@ -82,7 +81,7 @@ endsnippet
snippet def "defer func() { ... }"
defer func() {
${0}
${0:${VISUAL}}
}()
endsnippet
@ -90,7 +89,7 @@ endsnippet
snippet defr
defer func() {
if err := recover(); err != nil {
${0}
${0:${VISUAL}}
}
}()
endsnippet
@ -133,14 +132,14 @@ endsnippet
# if condition
snippet if "if ... { ... }"
if ${1:condition} {
${0}
${0:${VISUAL}}
}
endsnippet
# else snippet
snippet else
else {
${0}
${0:${VISUAL}}
}
endsnippet
@ -167,6 +166,14 @@ if err != nil {
${0}
endsnippet
snippet errh "Error handle and return" !b
if err != nil {
${1}
return
}
${0}
endsnippet
snippet json "\`json:key\`"
\`json:"${1:keyName}"\`
endsnippet
@ -179,21 +186,21 @@ endsnippet
# for loop
snippet for "for ... { ... }"
for ${1} {
${0}
${0:${VISUAL}}
}
endsnippet
# for integer loop
snippet fori "for 0..N-1 { ... }"
for ${1:i} := 0; $1 < ${2:N}; $1++ {
${0}
${0:${VISUAL}}
}
endsnippet
# for range loop
snippet forr "for k, v := range items { ... }"
for ${2:k}, ${3:v} := range ${1} {
${0}
${0:${VISUAL}}
}
endsnippet
@ -211,17 +218,17 @@ endsnippet
# Fmt Println debug
snippet fn "fmt.Println(...)"
fmt.Println("${1}")
fmt.Println("${1:${VISUAL}}")
endsnippet
# log printf
snippet lf "log.Printf(...)"
log.Printf("${1} = %+v\n", $1)
log.Printf("${1:${VISUAL}} = %+v\n", $1)
endsnippet
# log println
snippet ln "log.Println(...)"
log.Println("${1}")
log.Println("${1:${VISUAL}}")
endsnippet
# make
@ -237,7 +244,7 @@ endsnippet
# main()
snippet main "func main() { ... }"
func main() {
${0}
${0:${VISUAL}}
}
endsnippet
@ -251,7 +258,7 @@ endsnippet
# ok
snippet ok "if !ok { ... }"
if !ok {
${0}
${0:${VISUAL}}
}
endsnippet
@ -269,7 +276,7 @@ endsnippet
# return
snippet rt "return"
return ${0}
return ${0:${VISUAL}}
endsnippet
# select
@ -316,7 +323,7 @@ endsnippet
# test function
snippet test "func TestXYZ(t *testing.T) { ... }"
func Test${1:Function}(t *testing.T) {
${0}
${0:${VISUAL}}
}
endsnippet
@ -346,16 +353,26 @@ endsnippet
# variable declaration
snippet var "var x Type [= ...]"
var ${1:x} ${2:Type}${3: = ${0:value\}}
var ${1:x} ${2:Type}${3: = ${0:value}}
endsnippet
# variables declaration
snippet vars "var ( ... )"
var (
${1:x} ${2:Type}${3: = ${0:value\}}
${1:x} ${2:Type}${3: = ${0:value}}
)
endsnippet
# equals fails the test if exp is not equal to act.
snippet eq "equals: test two identifiers with DeepEqual"
if !reflect.DeepEqual(${1:expected}, ${2:actual}) {
_, file, line, _ := runtime.Caller(0)
fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2)
t.FailNow()
}
endsnippet
global !p
import re

View File

@ -139,6 +139,16 @@ abbr if err != nil { return [...], err }
}
${0}
# error snippet handle and return
snippet errh
abbr if err != nil { return }
if err != nil {
${1}
return
}
${0}
# json snippet
snippet json
abbr \`json:key\`
@ -304,3 +314,11 @@ abbr var ( ... )
var (
${1:x} ${2:Type}${3: = ${0:value\}}
)
# equals fails the test if exp is not equal to act.
snippet eq
abbr equals: test two identifiers with DeepEqual
if !reflect.DeepEqual(${1:expected}, ${2:actual}) {
_, file, line, _ := runtime.Caller(0)
fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2)
t.FailNow()
}