Add/update various Go snippets

This commit is contained in:
2014-07-10 18:31:43 +01:00
parent ba9a8a2298
commit 62d5cb244c
21 changed files with 89 additions and 12 deletions

9
snippets/go-mode/bench Normal file
View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# contributer: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
# name: bench
# key: bench
# description: add a benchmark method
# --
func Benchmark${1:Feature}(b *testing.B) {
$0
}

5
snippets/go-mode/el Normal file
View File

@@ -0,0 +1,5 @@
# key: el
# --
else {
$0
}

5
snippets/go-mode/elif Normal file
View File

@@ -0,0 +1,5 @@
# key: elif
# --
else if $1 {
$0
}

5
snippets/go-mode/else Normal file
View File

@@ -0,0 +1,5 @@
# key: else
# --
else {
$0
}

5
snippets/go-mode/for Normal file
View File

@@ -0,0 +1,5 @@
# key: for
# --
for $1 {
$0
}

5
snippets/go-mode/fori Normal file
View File

@@ -0,0 +1,5 @@
# key: fori
# --
for i := 0; i < $1; i++ {
$0
}

View File

@@ -1,6 +1,5 @@
# name: func
# key: func
# --
func ${1:name}($2) {
$0
}
}

6
snippets/go-mode/gof Normal file
View File

@@ -0,0 +1,6 @@
# name: go func(...) { ... }(...)
# key: gof
# --
go func($1) {
$0
}($2)

5
snippets/go-mode/if Normal file
View File

@@ -0,0 +1,5 @@
# key: if
# --
if $1 {
$0
}

7
snippets/go-mode/ifel Normal file
View File

@@ -0,0 +1,7 @@
# key: ifel
# --
if $1 {
$0
} else {
}

View File

@@ -1,6 +1,5 @@
# name: interface
# key: interface
# --
type ${1:InterfaceName} interface {
$0
}
}

View File

@@ -1,4 +1,3 @@
# name: main
# key: main
# --
package main

7
snippets/go-mode/make Normal file
View File

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# contributer: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
# name: make
# key: make
# description: snippet for make builtin
# --
make(${1:Type}, ${2:startingSize}, ${3:memorySize})$0

6
snippets/go-mode/meth Normal file
View File

@@ -0,0 +1,6 @@
# name: struct method
# key: meth
# --
func (${1:s *Struct}) ${2:Name}($3) ${4:returnType} {
$0
}

3
snippets/go-mode/mk Normal file
View File

@@ -0,0 +1,3 @@
# key: mk
# --
make($0)

View File

@@ -1,4 +1,3 @@
# name: pd
# key: pd
# --
fmt.Printf($0)
fmt.Println($0)

3
snippets/go-mode/pdf Normal file
View File

@@ -0,0 +1,3 @@
# key: pdf
# --
fmt.Printf($0)

View File

@@ -1,4 +0,0 @@
# name: pdl
# key: pdl
# --
fmt.Println($0)

6
snippets/go-mode/select Normal file
View File

@@ -0,0 +1,6 @@
# key: select
# --
select {
case $1:
$0
}

View File

@@ -1,4 +1,3 @@
# name: struct
# key: struct
# --
type ${1:StructName} struct {

9
snippets/go-mode/test Normal file
View File

@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# contributer: Yusuke Tsutsumi <tsutsumi.yusuke@gmail.com>
# name: test {}
# key: test
# description: add a test method
# --
func Test${1:Feature}(t *testing.T) {
$0
}