yasnippet
authorJoerg Jaspert <joerg.jaspert@dlh.de>
Wed, 5 Oct 2016 12:09:38 +0000 (14:09 +0200)
committerJoerg Jaspert <joerg.jaspert@dlh.de>
Wed, 5 Oct 2016 12:09:38 +0000 (14:09 +0200)
25 files changed:
.emacs.d/config/emacs.org
.emacs.d/snippets/puppet-mode/.yas-parents [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/? [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/case [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/class [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/cron [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/define [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/exec [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/file [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/hhashres [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/package [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/pkg [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/service [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/src [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/xaug [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/xfile [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/xnode [new file with mode: 0644]
.emacs.d/snippets/puppet-mode/xservice [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/.yas-parents [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/entry [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/fwip [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/fwport [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/fwrule [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/list [new file with mode: 0644]
.emacs.d/snippets/yaml-mode/section [new file with mode: 0644]

index 229c719..cc6b42d 100644 (file)
@@ -5155,6 +5155,9 @@ whatever the snippet holds.
     (yas-global-mode 1)
     (setq yas-expand-only-for-last-commands '(self-insert-command))
     (bind-key "\t" 'hippie-expand yas-minor-mode-map)
+    
+    (setq yas-snippet-dirs (expand-file-name "yasnippet/snippets" jj-elisp-dir))
+    (add-to-list 'yas-snippet-dirs (expand-file-name "snippets" jj-dir))
     ))
 #+END_SRC
 * Thats it
diff --git a/.emacs.d/snippets/puppet-mode/.yas-parents b/.emacs.d/snippets/puppet-mode/.yas-parents
new file mode 100644 (file)
index 0000000..eed5b44
--- /dev/null
@@ -0,0 +1 @@
+text-mode
diff --git a/.emacs.d/snippets/puppet-mode/? b/.emacs.d/snippets/puppet-mode/?
new file mode 100644 (file)
index 0000000..2ced51b
--- /dev/null
@@ -0,0 +1,7 @@
+#name : ?
+# --
+${1:name} ? {
+    ${2:value} => "${3:whatever}",
+    $0
+    default => "${4:whatever}",
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/case b/.emacs.d/snippets/puppet-mode/case
new file mode 100644 (file)
index 0000000..24913af
--- /dev/null
@@ -0,0 +1,8 @@
+#name : case
+# --
+
+case ${1:fact} {
+     ${2:value} : { ${3:whatever} }
+     $0
+     default : { ${4:whatever} }
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/class b/.emacs.d/snippets/puppet-mode/class
new file mode 100644 (file)
index 0000000..719b725
--- /dev/null
@@ -0,0 +1,42 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: class { ... }
+# key: class
+# --
+# == Class: ${1:name}
+#
+# This class contains ...
+#
+# === Parameters
+#
+# Document parameters here.
+#
+# === Variables
+#
+# Here you should define a list of variables that this module would require.
+#
+# [*sample_variable*]
+#   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." (Note,
+#   global variables should be avoided in favor of class parameters as
+#   of Puppet 2.6.)
+#
+# === Examples
+#
+#  class { $1:
+#    servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
+#  }
+#
+# === Authors
+#
+# Joerg Jaspert <joerg@nsb-software.de>
+#
+# === Copyright
+#
+# Copyright (C) `(format-time-string "%Y" (current-time))` by Joerg Jaspert <joerg@nsb-software.de>
+#
+class $1 (
+  $0
+) {
+  
+}
diff --git a/.emacs.d/snippets/puppet-mode/cron b/.emacs.d/snippets/puppet-mode/cron
new file mode 100644 (file)
index 0000000..41c02f1
--- /dev/null
@@ -0,0 +1,5 @@
+# name : cron
+# --
+cron {
+    $0
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/define b/.emacs.d/snippets/puppet-mode/define
new file mode 100644 (file)
index 0000000..c9770e4
--- /dev/null
@@ -0,0 +1,5 @@
+#name : define
+# --
+define ${1:name}($${2:arg}) {
+       $0
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/exec b/.emacs.d/snippets/puppet-mode/exec
new file mode 100644 (file)
index 0000000..e62ab7d
--- /dev/null
@@ -0,0 +1,5 @@
+# name : exec
+# --
+exec {
+   $0
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/file b/.emacs.d/snippets/puppet-mode/file
new file mode 100644 (file)
index 0000000..499525d
--- /dev/null
@@ -0,0 +1,5 @@
+#name : file { "name": }
+# --
+file { 
+     $0
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/hhashres b/.emacs.d/snippets/puppet-mode/hhashres
new file mode 100644 (file)
index 0000000..6c1bfbe
--- /dev/null
@@ -0,0 +1,9 @@
+# -*- mode: snippet -*-
+# name: hhashres
+# key: hhashres
+# --
+\$${1:varname} = hiera_hash('${2:hierakey}', '')
+if empty(\$$1) == false {
+  create_resources( ${3:puppetclass}, \$$1 )
+}
+$0
diff --git a/.emacs.d/snippets/puppet-mode/package b/.emacs.d/snippets/puppet-mode/package
new file mode 100644 (file)
index 0000000..4eb229b
--- /dev/null
@@ -0,0 +1,5 @@
+#name : package
+# --
+package { 
+    $0
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/pkg b/.emacs.d/snippets/puppet-mode/pkg
new file mode 100644 (file)
index 0000000..dfe22e7
--- /dev/null
@@ -0,0 +1,8 @@
+# name: pkg { ... }
+# key: pkg
+# --
+package { "${1:name}":
+  ensure  => ${2:installedt},
+  source  => ${3:<source>},
+  require => Package[${4:<requiree>}];
+}
diff --git a/.emacs.d/snippets/puppet-mode/service b/.emacs.d/snippets/puppet-mode/service
new file mode 100644 (file)
index 0000000..e1205ab
--- /dev/null
@@ -0,0 +1,5 @@
+#name : service
+# --
+service { 
+    $0
+}
\ No newline at end of file
diff --git a/.emacs.d/snippets/puppet-mode/src b/.emacs.d/snippets/puppet-mode/src
new file mode 100644 (file)
index 0000000..5708675
--- /dev/null
@@ -0,0 +1,4 @@
+# name: source
+# key: src
+# --
+source => "puppet://${1:source}",
diff --git a/.emacs.d/snippets/puppet-mode/xaug b/.emacs.d/snippets/puppet-mode/xaug
new file mode 100644 (file)
index 0000000..6cf836c
--- /dev/null
@@ -0,0 +1,8 @@
+# name: xaugeas { ... }
+# key: xaug
+# --
+"${1:name}":
+  context => "${2:/files/etc/}",
+  changes => [
+    set $0,
+  ];
diff --git a/.emacs.d/snippets/puppet-mode/xfile b/.emacs.d/snippets/puppet-mode/xfile
new file mode 100644 (file)
index 0000000..ed0a1e3
--- /dev/null
@@ -0,0 +1,11 @@
+# name: xfile { ... }
+# key: xfile
+# --
+"${1:name}":
+  owner   => ${2:owner},
+  group   => ${3:group},
+  mode    => ${4:mode},
+  ensure  => ${5:ensure},
+  require => ${6:require},
+  content => ${7:content},
+  source  => ${8:source};
diff --git a/.emacs.d/snippets/puppet-mode/xnode b/.emacs.d/snippets/puppet-mode/xnode
new file mode 100644 (file)
index 0000000..363b768
--- /dev/null
@@ -0,0 +1,6 @@
+# name: xnode { ... }
+# key: xnode
+# --
+node '${1:name}' inherits ${2:parent} {
+  include $0
+}
diff --git a/.emacs.d/snippets/puppet-mode/xservice b/.emacs.d/snippets/puppet-mode/xservice
new file mode 100644 (file)
index 0000000..cafbc1f
--- /dev/null
@@ -0,0 +1,7 @@
+# name: xservice { ... }
+# key: xservice
+# --
+"${1:name}":
+  ensure    => ${2:running},
+  require   => ${3:Package["requiree"]},
+  subscribe => ${4:File["requiree"]};
diff --git a/.emacs.d/snippets/yaml-mode/.yas-parents b/.emacs.d/snippets/yaml-mode/.yas-parents
new file mode 100644 (file)
index 0000000..d58dacb
--- /dev/null
@@ -0,0 +1 @@
+text-mode
\ No newline at end of file
diff --git a/.emacs.d/snippets/yaml-mode/entry b/.emacs.d/snippets/yaml-mode/entry
new file mode 100644 (file)
index 0000000..e1f7cde
--- /dev/null
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: entry
+# key: entry
+# --
+${1:entry}: ${2:value}
+$0
diff --git a/.emacs.d/snippets/yaml-mode/fwip b/.emacs.d/snippets/yaml-mode/fwip
new file mode 100644 (file)
index 0000000..8fb8214
--- /dev/null
@@ -0,0 +1,8 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: firewall ip
+# key: fwip
+# --
+IP_${1:IPNAME}:
+  content: '(${2:IPCONTENT})'
+  description: '$1: ${3:IPDESC}'
+$0
diff --git a/.emacs.d/snippets/yaml-mode/fwport b/.emacs.d/snippets/yaml-mode/fwport
new file mode 100644 (file)
index 0000000..3467cb7
--- /dev/null
@@ -0,0 +1,8 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: firewall port
+# key: fwp
+# --
+PORT_${1:PORTNAME}:
+  content: '(${2:PORTCONTENT})'
+  description: '$1: ${3:PORTDESC}'
+$0
diff --git a/.emacs.d/snippets/yaml-mode/fwrule b/.emacs.d/snippets/yaml-mode/fwrule
new file mode 100644 (file)
index 0000000..7cbea75
--- /dev/null
@@ -0,0 +1,11 @@
+# -*- mode: snippet; require-final-newline: nil -*-
+# name: firewall rule
+# key: fwr
+# --
+${1:rulename}:
+  description: '$1: ${2:RULEDESC}'
+  chain: '${3:$$(yas-choose-value '("INPUT" "OUTPUT" ""))}'
+  prio: '${4:50}'
+  rules:
+    - 'proto ${5:$$(yas-choose-value '("tcp" "udp"))} ${6:$$(yas-choose-value '("dport" "sport"))} ${7:PORT} ${8:$$(yas-choose-value '("daddr" "saddr"))} ${9:IPADDRESS} ${10:$$(yas-choose-value '("ACCEPT" "jump LREJECT"))};'
+$0
diff --git a/.emacs.d/snippets/yaml-mode/list b/.emacs.d/snippets/yaml-mode/list
new file mode 100644 (file)
index 0000000..89d97eb
--- /dev/null
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: list
+# key: list
+# --
+[$1]
+$0
\ No newline at end of file
diff --git a/.emacs.d/snippets/yaml-mode/section b/.emacs.d/snippets/yaml-mode/section
new file mode 100644 (file)
index 0000000..5e8782d
--- /dev/null
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: section
+# key: --
+# --
+--- # ${1:section}
+$0
\ No newline at end of file