]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
Snippets and more snippets.
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 9 Nov 2018 14:54:40 +0000 (15:54 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 9 Nov 2018 14:54:40 +0000 (15:54 +0100)
More snippets less typing. Easy!

Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
snippets/cperl-mode/while [new file with mode: 0644]
snippets/json-mode/aws-ref [new file with mode: 0644]
snippets/json-mode/parameter [new file with mode: 0644]
snippets/org-mode/eval-never [new file with mode: 0644]
snippets/org-mode/jira-link [new file with mode: 0644]
snippets/python-mode/de [new file with mode: 0644]

diff --git a/snippets/cperl-mode/while b/snippets/cperl-mode/while
new file mode 100644 (file)
index 0000000..2744530
--- /dev/null
@@ -0,0 +1,6 @@
+# name: while (...) { ... }
+# key: while
+# --
+while ($1) {
+    $0
+}
\ No newline at end of file
diff --git a/snippets/json-mode/aws-ref b/snippets/json-mode/aws-ref
new file mode 100644 (file)
index 0000000..9c7913b
--- /dev/null
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: aws-ref
+# key: ref_
+# expand-env: ((yas/indent-line 'auto) (yas/wrap-around-region 't))
+# --
+{"Ref": "$1"}$0
\ No newline at end of file
diff --git a/snippets/json-mode/parameter b/snippets/json-mode/parameter
new file mode 100644 (file)
index 0000000..04e5211
--- /dev/null
@@ -0,0 +1,10 @@
+# -*- mode: snippet -*-
+# name: parameter
+# key: pm_
+# expand-env: ((yas/indent-line 'auto) (yas/wrap-around-region 't))
+# --
+"$1": {
+  "Description": "$2",
+  "Type": "${3:$$(yas-choose-value '("String" "Number" "List" "CommaDelimitedList"))}",
+  "Default": "$4"
+},$0
\ No newline at end of file
diff --git a/snippets/org-mode/eval-never b/snippets/org-mode/eval-never
new file mode 100644 (file)
index 0000000..fa328f6
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: eval-never
+# key: :en
+# --
+:eval never
\ No newline at end of file
diff --git a/snippets/org-mode/jira-link b/snippets/org-mode/jira-link
new file mode 100644 (file)
index 0000000..ce305e3
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: jira-link
+# key: jlink_
+# --
+[${2:link title}|${1:url}]
\ No newline at end of file
diff --git a/snippets/python-mode/de b/snippets/python-mode/de
new file mode 100644 (file)
index 0000000..1b6aecb
--- /dev/null
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# name: de
+# contributor: Orestis Markou
+# contributor: Yasser González Fernández <yglez@uh.cu>
+# contributor: Tibor Simko <tibor.simkoNOSPAMcern.ch>
+# --
+def ${1:name}($2):
+    """
+    $3
+    ${2:$
+    (let* ((indent
+            (concat "\n" (make-string (current-column) 32)))
+           (args
+            (mapconcat
+             '(lambda (x)
+                (if (not (string= (nth 0 x) ""))
+                    (concat "@param " (nth 0 x) ": " indent
+                            "@type " (nth 0 x) ": ")))
+             (mapcar
+              '(lambda (x)
+                 (mapcar
+                  '(lambda (x)
+                     (replace-regexp-in-string "[[:blank:]]*$" ""
+                      (replace-regexp-in-string "^[[:blank:]]*" "" x)))
+                  x))
+              (mapcar '(lambda (x) (split-string x "="))
+                      (split-string text ",")))
+             indent)))
+      (if (string= args "")
+          (concat indent "@return: " indent "@rtype: " indent (make-string 3 34))
+        (mapconcat
+         'identity
+         (list "" args "@return: " "@rtype: " (make-string 3 34))
+         indent)))
+    }
+    $0
\ No newline at end of file