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
2016-05-14 12:57:54 +01:00
parent 5f6aa8fe09
commit f343b66088
105 changed files with 2100 additions and 4902 deletions

View File

@ -327,6 +327,18 @@ func Test${1:Function}(t *testing.T) {
}
endsnippet
snippet hf "http.HandlerFunc" !b
func ${1:handler}(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
}
endsnippet
snippet hhf "mux.HandleFunc" !b
${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
})
endsnippet
# quick test server
snippet tsrv "httptest.NewServer"
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@ -351,6 +363,21 @@ if err != nil {
}
endsnippet
snippet example "func ExampleXYZ() { ... }"
func Example${1:Method}() {
${0:${VISUAL}}
// Output:
}
endsnippet
snippet benchmark "func BenchmarkXYZ(b *testing.B) { ... }"
func Benchmark${1:Method}(b *testing.B) {
for i := 0; i < b.N; i++ {
${0:${VISUAL}}
}
}
endsnippet
# variable declaration
snippet var "var x Type [= ...]"
var ${1:x} ${2:Type}${3: = ${0:value}}
@ -372,7 +399,6 @@ if !reflect.DeepEqual(${1:expected}, ${2:actual}) {
}
endsnippet
global !p
import re

View File

@ -305,6 +305,21 @@ abbr if err != nil { t.Fatalf(...) }
if err != nil {
t.Fatalf("${1}")
}
# test example
snippet example
func Example${1:Method}() {
${0}
// Output:
}
endsnippet
# test benchmark
snippet benchmark
func Benchmark${1:Method}(b *testing.B) {
for i := 0; i < b.N; i++ {
${0}
}
}
endsnippet
# variable declaration
snippet var
abbr var x Type [= ...]
@ -323,3 +338,15 @@ abbr equals: test two identifiers with DeepEqual
fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2)
t.FailNow()
}
snippet hf
abbr http.HandlerFunc
func ${1:handler}(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
}
snippet hhf
abbr mux.HandleFunc(...)
${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
})