mirror of
https://github.com/amix/vimrc
synced 2024-12-19 08:23:09 +00:00
236 lines
4.7 KiB
Text
236 lines
4.7 KiB
Text
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
|
|
#
|
|
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
|
|
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
|
|
|
|
# Header to match http://docs.puppetlabs.com/guides/style_guide.html#puppet-doc
|
|
snippet classheader
|
|
# == Class: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'name')`}
|
|
#
|
|
# ${2:Full description of class $1 here}
|
|
#
|
|
# === Parameters
|
|
#
|
|
# Document parameters here.
|
|
#
|
|
# [*parameter1*]
|
|
# Explanation of what this parameter affects and what it defaults to.
|
|
# e.g. "Specify one or more upstream ntp servers as an array."
|
|
#
|
|
# === Variables
|
|
#
|
|
# Here you should define a list of variables that this module would require.
|
|
#
|
|
# [*variable1*]
|
|
# Explanation of how this variable affects the funtion of this class and
|
|
# if it has a default. e.g. "The parameter enc_ntp_servers must be set by the
|
|
# External Node Classifier as a comma separated list of hostnames."
|
|
#
|
|
# === Examples
|
|
#
|
|
# class { '$1':
|
|
# parameter1 => [ 'just', 'an', 'example', ]
|
|
# }
|
|
#
|
|
# === Authors
|
|
#
|
|
# `g:snips_author` <`g:snips_email`>
|
|
#
|
|
# === Copyright
|
|
#
|
|
# Copyright `strftime("%Y")` `g:snips_author`
|
|
#
|
|
class $1 (${3}){
|
|
${4}
|
|
}
|
|
|
|
snippet defheader
|
|
# == Define: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:r:s?/manifests/?::?'), 'name')`}
|
|
#
|
|
# ${2:Full description of defined resource type $1 here}
|
|
#
|
|
# === Parameters
|
|
#
|
|
# Document parameters here
|
|
#
|
|
# [*namevar*]
|
|
# If there is a parameter that defaults to the value of the title string
|
|
# when not explicitly set, you must always say so. This parameter can be
|
|
# referred to as a "namevar," since it's functionally equivalent to the
|
|
# namevar of a core resource type.
|
|
#
|
|
# [*basedir*]
|
|
# Description of this variable. For example, "This parameter sets the
|
|
# base directory for this resource type. It should not contain a trailing
|
|
# slash."
|
|
#
|
|
# === Examples
|
|
#
|
|
# Provide some examples on how to use this type:
|
|
#
|
|
# $1 { 'namevar':
|
|
# basedir => '/tmp/src',
|
|
# }
|
|
#
|
|
# === Authors
|
|
#
|
|
# `g:snips_author` <`g:snips_email`>
|
|
#
|
|
# === Copyright
|
|
#
|
|
# Copyright `strftime("%Y")` `g:snips_author`
|
|
#
|
|
define $1(${3}) {
|
|
${4}
|
|
}
|
|
|
|
# Language Constructs
|
|
snippet class
|
|
class ${1:`vim_snippets#Filename('', 'name')`} {
|
|
${0}
|
|
}
|
|
snippet node
|
|
node "${1:`vim_snippets#Filename('', 'fqdn')`}" {
|
|
${0}
|
|
}
|
|
snippet case
|
|
case $${1:variable} {
|
|
default: { ${0} }
|
|
}
|
|
snippet ife
|
|
if $${1:variable} {
|
|
${2}
|
|
} else {
|
|
${0}
|
|
}
|
|
snippet if
|
|
if $${1:variable} {
|
|
${0}
|
|
}
|
|
snippet el
|
|
else {
|
|
${0}
|
|
}
|
|
snippet ?
|
|
? {
|
|
'${1}' => ${0}
|
|
}
|
|
#
|
|
# blocks etc and general syntax sugar
|
|
snippet [
|
|
[ ${1} ]
|
|
snippet >
|
|
${1} => ${0}
|
|
snippet p:
|
|
"puppet://puppet/${1:module name}/${0:file name}"
|
|
#
|
|
# Functions
|
|
snippet alert
|
|
alert("${1:message}")
|
|
snippet crit
|
|
crit("${1:message}")
|
|
snippet debug
|
|
debug("${1:message}")
|
|
snippet defined
|
|
defined(${1:Resource}["${2:name}"])
|
|
snippet emerg
|
|
emerg("${1:message}")
|
|
snippet extlookup Simple extlookup
|
|
extlookup("${1:variable}")
|
|
snippet extlookup Extlookup with defaults
|
|
extlookup("${1:variable}", "${2:default}")
|
|
snippet extlookup Extlookup with defaults and custom data file
|
|
extlookup("${1:variable}", "${2:default}", "${3:data source}")
|
|
snippet fail
|
|
fail("${1:message}")
|
|
snippet info
|
|
info("${1:message}")
|
|
snippet inline_template
|
|
inline_template("<%= ${1} %>")
|
|
snippet notice
|
|
notice("${1:message}")
|
|
snippet realize
|
|
realize(${1:Resource}[${2:name}])
|
|
snippet regsubst
|
|
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")
|
|
snippet inc
|
|
include ${1:classname}
|
|
snippet split
|
|
split(${1:hay stack}, "${2:patten}")
|
|
snippet versioncmp
|
|
versioncmp("${1:version}", "${2:version}")
|
|
snippet warning
|
|
warning("${1:message}")
|
|
#
|
|
# Types
|
|
snippet cron
|
|
cron{ "${1:name}":
|
|
command => "${2}",
|
|
user => "${3:root}",
|
|
${4} => ${0}
|
|
}
|
|
|
|
snippet exec
|
|
exec{ "${1:name}":
|
|
command => "${2:$1}",
|
|
user => "${3:root}",
|
|
${4} => ${0}
|
|
}
|
|
|
|
snippet user
|
|
user{ "${1:user}":
|
|
comment => "${2:$1}",
|
|
ensure => present,
|
|
managehome => true,
|
|
home => "${0:/home/$1}"
|
|
}
|
|
|
|
snippet group
|
|
group{ "${1:group}":
|
|
ensure => ${0:present}
|
|
}
|
|
|
|
snippet host
|
|
host{ "${1:hostname}":
|
|
ip => ${0:127.0.0.1}
|
|
}
|
|
|
|
snippet mailalias
|
|
mailalias{ "${1:localpart}":
|
|
recipient => "${0:recipient}"
|
|
}
|
|
|
|
snippet mount
|
|
mount{ "${1:destination path}":
|
|
ensure => ${2:mounted},
|
|
device => "${0:device name or path}"
|
|
}
|
|
|
|
snippet package
|
|
package{ "${1:package name}":
|
|
ensure => ${0:present}
|
|
}
|
|
|
|
snippet yumrepo
|
|
yumrepo{ "${1:repo name}":
|
|
descr => "${2:$1}",
|
|
enabled => ${0:1}
|
|
}
|
|
|
|
snippet define
|
|
define ${1} (${2}) {
|
|
${0}
|
|
}
|
|
|
|
snippet service
|
|
service{ "${1:service}":
|
|
enable => ${2:true},
|
|
ensure => ${0:running},
|
|
hasstatus => true,
|
|
}
|
|
|
|
snippet file
|
|
file{ "${1:path}":
|
|
${2} => ${0}
|
|
}
|
|
|