mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vim plugins
This commit is contained in:
@ -226,3 +226,29 @@ snippet bench benchmark function
|
||||
}
|
||||
}
|
||||
${0}
|
||||
# composite literals
|
||||
snippet cl
|
||||
type ${1:name} struct {
|
||||
${2:attrName} ${3:attrType}
|
||||
}
|
||||
# if key in a map
|
||||
snippet om
|
||||
if ${1:value}, ok := ${2:map}[${3:key}]; ok == true {
|
||||
${4:/* code */}
|
||||
}
|
||||
|
||||
# Grouped globals with anonymous struct
|
||||
snippet gg
|
||||
var ${1:var} = struct{
|
||||
${2:name} ${3:type}
|
||||
}{
|
||||
$2: ${4:value},
|
||||
}
|
||||
|
||||
# Marshalable json alias
|
||||
snippet ja
|
||||
type ${1:parentType}Alias $1
|
||||
|
||||
func (p *$1) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)})
|
||||
}
|
||||
|
Reference in New Issue
Block a user