snippet p package ${1:main} ${2} snippet i import ( "${1}" ) ${2} snippet t type ${1} struct { ${2} } ${3} snippet ti type ${1} interface { ${2} } ${3} snippet c package `Filename()` import ( "context" _ "context/cli" ) type `toupper(substitute(expand("%:t"), ".go", "", ""))` struct { *ctx.Context } func (`Filename()` *`toupper(substitute(expand("%:t"), ".go", "", ""))`) Begin(m *ctx.Message) ctx.Server { return nil } func (`Filename()` *`toupper(substitute(expand("%:t"), ".go", "", ""))`) Start(m *ctx.Message) bool { return true } func (`Filename()` *`toupper(substitute(expand("%:t"), ".go", "", ""))`) Spawn(c *ctx.Context, m *ctx.Message, arg ...string) ctx.Server { c.Caches = map[string]*ctx.Cache{} c.Configs = map[string]*ctx.Config{} c.Commands = map[string]*ctx.Command{} s := new(`toupper(substitute(expand("%:t"), ".go", "", ""))`) s.Context = c return s } func (`Filename()` *`toupper(substitute(expand("%:t"), ".go", "", ""))`) Exit(m *ctx.Message, arg ...string) bool { return true } var Index = &ctx.Context{Name: "`Filename()`", Help: "${1}", Caches: map[string]*ctx.Cache{}, Configs: map[string]*ctx.Config{}, Commands: map[string]*ctx.Command{}, } func init() { `Filename()` := &`toupper(substitute(expand("%:t"), ".go", "", ""))`{} `Filename()`.Context = Index ctx.Index.Register(Index, `Filename()`) } snippet cmd "${1}": &ctx.Command{Name: "${2}", Help: "${3}", Hand: func(c *ctx.Context, m *ctx.Message, key string, arg ...string) string { ${4} return "" }}, snippet conf "${1}": &ctx.Config{Name: "${2}", Value: "${3}", Help: "${4}", Hand: func(c *ctx.Context, x *ctx.Config, arg ...string) string { if len(arg) > 0 { ${5} } return x.Value }}, snippet cap "${1}": &ctx.Cache{Name: "${2}", Value: "${3}", Help: "${4}", Hand: func(c *ctx.Context, x *ctx.Cache, arg ...string) string { if len(arg) > 0 { x.Value = arg[0] ${5} } return x.Value }}, snippet v var ( ${1} ) ${2} snippet m func main() { ${1} } snippet h func(w http.ResponseWriter, r *http.Request) { ${1} }) snippet f func${1}(${2}) ${3}{ ${4} }${5} snippet ( (${1})${2} snippet [ [${1}]${2} snippet { {${1}}${2} snippet if if ${1} { ${2} } ${3} snippet for for ${1}{ ${2} } ${3} snippet switch switch ${1}{ case ${2}: ${3} } ${4} snippet select select { case ${1}: ${2} } ${3}