Merged puppet and go snippets by Miek Gieben
This commit is contained in:
commit
4e30504862
107
UltiSnips/go.snippets
Normal file
107
UltiSnips/go.snippets
Normal file
@ -0,0 +1,107 @@
|
||||
# Snippets for Go
|
||||
|
||||
# when to abbriviate and when not?
|
||||
# b doesn't work here, because it ignores whitespace
|
||||
# optional local name?
|
||||
snippet /^import/ "Import declaration" r
|
||||
import (
|
||||
"${1:package}"
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet /^package/ "Package declaration" r
|
||||
// Package $1 provides ...
|
||||
package ${1:main}
|
||||
endsnippet
|
||||
|
||||
# Mostly converted from: https://github.com/AlanQuatermain/go-tmbundle
|
||||
snippet /^cons/ "Constants declaration" r
|
||||
const (
|
||||
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet /^con/ "Constant declaration" r
|
||||
const ${1:name}${2/(.+)/ /}${2:type} = ${0:value}
|
||||
endsnippet
|
||||
|
||||
snippet iota "Iota constant generator" b
|
||||
const (
|
||||
${1:constant}${2/(.+)/ /}${2:type} = iota
|
||||
)
|
||||
endsnippet
|
||||
|
||||
# statements
|
||||
snippet for "For loop" !b
|
||||
for ${1:condition}${1/(.+)/ /}{
|
||||
${0:// body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forr "For range loop" !b
|
||||
for ${2:name} := range ${1:collection} {
|
||||
${0:// body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "If statement" !b
|
||||
if ${1:condition}${1/(.+)/ /}{
|
||||
${0:// body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet switch "Switch statement" !b
|
||||
switch ${1:expression}${1/(.+)/ /}{
|
||||
case${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet case "Case clause" !b
|
||||
case ${1:condition}:
|
||||
${0://body}
|
||||
endsnippet
|
||||
|
||||
snippet default "Default clause" !b
|
||||
default:
|
||||
${0://body}
|
||||
endsnippet
|
||||
|
||||
# functions
|
||||
snippet /^main/ "Main function" r
|
||||
func main() {
|
||||
${0:// body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /^meth/ "Method" r
|
||||
func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
|
||||
${0:// body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /^func/ "Function" r
|
||||
func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
||||
${0:// body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# types and variables
|
||||
snippet map "Map type" !b
|
||||
map[${1:keytype}]${2:valtype}
|
||||
endsnippet
|
||||
|
||||
snippet : "Variable declaration :=" !b
|
||||
${1:name} := ${0:value}
|
||||
endsnippet
|
||||
|
||||
snippet var "Variable declaration" !b
|
||||
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
|
||||
endsnippet
|
||||
|
||||
snippet vars "Variables declaration" !b
|
||||
var (
|
||||
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
|
||||
)
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
78
UltiSnips/puppet.snippets
Normal file
78
UltiSnips/puppet.snippets
Normal file
@ -0,0 +1,78 @@
|
||||
# Snippets for Puppet
|
||||
|
||||
snippet /^class/ "Class declaration" r
|
||||
class ${1:name} {
|
||||
${0:# body}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet File "Defaults for file" b
|
||||
File {
|
||||
owner => ${1:username},
|
||||
group => ${2:groupname},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Resource types
|
||||
snippet package "Package resource type" b
|
||||
package { "${1:name}":
|
||||
ensure => ${2:installed},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet file "File resource type" b
|
||||
file { "${1:name}":
|
||||
source => "puppet://${2:path}",
|
||||
mode => ${3:mode},
|
||||
endsnippet
|
||||
|
||||
snippet group "Group resource type" b
|
||||
group { "${1:groupname}":
|
||||
ensure => ${3:present},
|
||||
gid => ${2:gid},
|
||||
endsnippet
|
||||
|
||||
snippet user "user resource type" b
|
||||
group { "${1:username}":
|
||||
ensure => ${2:present},
|
||||
uid => ${3:uid},
|
||||
gid => ${4:gid},
|
||||
comment => ${5:gecos},
|
||||
home => ${6:homedirectory},
|
||||
managehome => false,
|
||||
require => Group["${7:group"],
|
||||
endsnippet
|
||||
|
||||
snippet exec "Exec resource type" b
|
||||
exec { "${1:command}":
|
||||
refreshonly => true,
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cron "Cron resource type" b
|
||||
cron { "${1:name}":
|
||||
user => ${2:user},
|
||||
command => "${3:command}",
|
||||
minute => ${3:minute},
|
||||
hour => ${4:hour},
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mount "Mount resource type" b
|
||||
mount { "${1:path}":
|
||||
device => "${2:/dev}",
|
||||
fstype => "${3:filesystem}",
|
||||
ensure => mounted,
|
||||
options => "rw,errors=remount-ro",
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet service "Service resource type" b
|
||||
service { "${1:name}":
|
||||
hasstatus => true,
|
||||
enable => true,
|
||||
ensure => running,
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
@ -779,6 +779,7 @@ Contributers are listed in chronological order:
|
||||
Gordin (g0rdin)
|
||||
Jan Mollowitz (phux)
|
||||
Georgi Valkov (gvalkov)
|
||||
Miek Gieben (miek)
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user