diff options
Diffstat (limited to 'templates/snippets')
| l--------- | templates/snippets/c-mode/doxycomments | 1 | ||||
| -rw-r--r-- | templates/snippets/c-mode/headerDEF | 8 | ||||
| -rw-r--r-- | templates/snippets/clojure-mode/defn | 8 | ||||
| -rw-r--r-- | templates/snippets/clojure-mode/let | 5 | ||||
| -rw-r--r-- | templates/snippets/doxygen/doxycomments | 48 | ||||
| -rw-r--r-- | templates/snippets/python-mode/import_from | 5 | ||||
| -rw-r--r-- | templates/snippets/python-mode/lambda | 5 | ||||
| -rw-r--r-- | templates/snippets/python-mode/print | 5 | ||||
| -rw-r--r-- | templates/snippets/python-mode/print format | 5 | ||||
| -rw-r--r-- | templates/snippets/python-mode/script | 10 |
10 files changed, 100 insertions, 0 deletions
diff --git a/templates/snippets/c-mode/doxycomments b/templates/snippets/c-mode/doxycomments new file mode 120000 index 0000000..62fd598 --- /dev/null +++ b/templates/snippets/c-mode/doxycomments @@ -0,0 +1 @@ +../doxygen/doxycomments
\ No newline at end of file diff --git a/templates/snippets/c-mode/headerDEF b/templates/snippets/c-mode/headerDEF new file mode 100644 index 0000000..a07587b --- /dev/null +++ b/templates/snippets/c-mode/headerDEF @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: headerDEF +# key: #if +# -- +#ifndef +#define + +#endif
\ No newline at end of file diff --git a/templates/snippets/clojure-mode/defn b/templates/snippets/clojure-mode/defn new file mode 100644 index 0000000..0907e4a --- /dev/null +++ b/templates/snippets/clojure-mode/defn @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: defn +# key: defn +# -- +defn ${1:name} + "${2:docstring}" + [${3:arg-list}] + $0
\ No newline at end of file diff --git a/templates/snippets/clojure-mode/let b/templates/snippets/clojure-mode/let new file mode 100644 index 0000000..426caa2 --- /dev/null +++ b/templates/snippets/clojure-mode/let @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: let +# key: let +# -- +let [$0] diff --git a/templates/snippets/doxygen/doxycomments b/templates/snippets/doxygen/doxycomments new file mode 100644 index 0000000..94209bc --- /dev/null +++ b/templates/snippets/doxygen/doxycomments @@ -0,0 +1,48 @@ +# -*- mode: snippet -*- +# name: doxcomments +# key: dox +# type: command +# -- +;; Command to generate doxygen comments for c functions + +(defun flatten (ls) + "Implements standard flatten function" + (cond + ((atom ls) (list ls)) + ((null (cdr ls)) (flatten (car ls))) + (t (append (flatten (car ls)) (flatten (cdr ls)))))) + +(defun find-retval () + "Returns the return value of the next parsed function" + (interactive) + (let ((struct-type "struct")) + (search-forward "(" nil t) + (move-beginning-of-line nil) + (let ((return-type (thing-at-point 'symbol))) + (if (string= return-type struct-type) + "NOT_IMPLEMENTED" + return-type)))) + +(defun find-args () + "Returns a list of function args for the next parsed function" + (interactive) + (let* ((struct-type "struct") + (start (search-forward "(" nil t)) + (end (search-forward ")" nil t)) + (args-string (buffer-substring-no-properties start (1- end))) + (args (mapcar 'string-trim-left (split-string args-string "," t)))) + (mapcar (lambda (x) (car (reverse x))) (mapcar 'split-string args)))) + +(let* ((retval (find-retval)) + (args (find-args)) + (args-len (length args)) + (brief "@brief $1\n *") + (params (mapcar (lambda (x) (format "@param: %s ${%d:}" (cdr x) (car x))) + (mapcar* 'cons + (mapcar '1+ (number-sequence 1 args-len)) + args))) + (retval (format "@return %s $0" retval)) + (snippet-text (mapconcat 'identity (flatten (list "/**" brief params (concat "\n * " retval))) + "\n * "))) + (move-beginning-of-line nil) + (yas-expand-snippet (concat snippet-text "\n*/\n"))) diff --git a/templates/snippets/python-mode/import_from b/templates/snippets/python-mode/import_from new file mode 100644 index 0000000..767f344 --- /dev/null +++ b/templates/snippets/python-mode/import_from @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: import_from +# key: from +# -- +from $1 import $0 diff --git a/templates/snippets/python-mode/lambda b/templates/snippets/python-mode/lambda new file mode 100644 index 0000000..08b268b --- /dev/null +++ b/templates/snippets/python-mode/lambda @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: lambda +# key: lam +# -- +lambda ${1:x}: $0
\ No newline at end of file diff --git a/templates/snippets/python-mode/print b/templates/snippets/python-mode/print new file mode 100644 index 0000000..2392fbd --- /dev/null +++ b/templates/snippets/python-mode/print @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: print +# key: print +# -- +print("$0")
\ No newline at end of file diff --git a/templates/snippets/python-mode/print format b/templates/snippets/python-mode/print format new file mode 100644 index 0000000..704cb53 --- /dev/null +++ b/templates/snippets/python-mode/print format @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: print format +# key: printf +# -- +print("$1".format($0))
\ No newline at end of file diff --git a/templates/snippets/python-mode/script b/templates/snippets/python-mode/script new file mode 100644 index 0000000..3113da9 --- /dev/null +++ b/templates/snippets/python-mode/script @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: script +# key: script +# -- +#!/usr/bin/env python +def main(): + ${1:pass} + +if __name__ == '__main__': + main()
\ No newline at end of file |
