1
0
Fork 0

Add some Sublime snippets

This commit is contained in:
Gregory Eremin 2017-10-05 13:25:41 +02:00
parent 8a1c230730
commit eb18b0bcb6
9 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,12 @@
<snippet>
<tabTrigger>bench</tabTrigger>
<scope>source.go</scope>
<description>Benchmark</description>
<content><![CDATA[
func Benchmark${1}(b *testing.B) {
for i := 0; i < b.N; i++ {
${2}
}
}
]]></content>
</snippet>

View File

@ -0,0 +1,8 @@
<snippet>
<tabTrigger>pp</tabTrigger>
<scope>source.go</scope>
<description>Pretty Print</description>
<content><![CDATA[
pretty.Println(${1})
]]></content>
</snippet>

View File

@ -0,0 +1,10 @@
<snippet>
<tabTrigger>test</tabTrigger>
<scope>source.go</scope>
<description>Test case</description>
<content><![CDATA[
func Test${1}(t *testing.T) {
${2}
}
]]></content>
</snippet>

View File

@ -0,0 +1,8 @@
<snippet>
<tabTrigger>do</tabTrigger>
<scope>source.go</scope>
<description>double assignment</description>
<content><![CDATA[
${1:v}, ${2:err} := ${3:statement}
]]></content>
</snippet>

View File

@ -0,0 +1,10 @@
<snippet>
<tabTrigger>ife</tabTrigger>
<scope>source.go</scope>
<description>panic on error</description>
<content><![CDATA[
if ${1:err} != nil {
${2:panic}(${1})
}
]]></content>
</snippet>

View File

@ -0,0 +1,10 @@
<snippet>
<tabTrigger>ran</tabTrigger>
<scope>source.go</scope>
<description>range loop</description>
<content><![CDATA[
for ${1:_}, ${2:item} := range ${3:collection} {
${4}
}
]]></content>
</snippet>

View File

@ -0,0 +1,8 @@
<snippet>
<tabTrigger>ret</tabTrigger>
<scope>source.go</scope>
<description>return statement</description>
<content><![CDATA[
return
]]></content>
</snippet>

View File

@ -0,0 +1,13 @@
<snippet>
<tabTrigger>sel</tabTrigger>
<scope>source.go</scope>
<description>select statement</description>
<content><![CDATA[
select {
case <-${1:chan}:
${2}
default:
${3}
}
]]></content>
</snippet>

View File

@ -0,0 +1,13 @@
<snippet>
<tabTrigger>swi</tabTrigger>
<scope>source.go</scope>
<description>switch statement</description>
<content><![CDATA[
switch ${1:var} {
case ${2:val}
${3}
${4:default:
${5}
\}}
]]></content>
</snippet>