diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-04-24 23:29:38 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2012-04-24 23:29:38 +0200 |
commit | 7a6bb0f05e349068b0a89514f1da33d6d7de30a9 (patch) | |
tree | c202b81dfaf524e71e881c15aa509c45445a64b3 /emacs.d/lisp/yasnippet/snippets/python-mode | |
parent | 66b95ab46d870f41c12c489eb21c9c82846d6112 (diff) | |
download | dotfiles-7a6bb0f05e349068b0a89514f1da33d6d7de30a9.tar.gz dotfiles-7a6bb0f05e349068b0a89514f1da33d6d7de30a9.tar.xz dotfiles-7a6bb0f05e349068b0a89514f1da33d6d7de30a9.zip |
emacs.d/lisp/yasnippet: added yasnippet
Diffstat (limited to 'emacs.d/lisp/yasnippet/snippets/python-mode')
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/.yas-parents | 1 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/__ | 3 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/class | 54 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/def | 35 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/defm | 33 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/for | 4 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/ifmain | 4 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/prop | 15 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/propg | 9 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/propsg | 12 | ||||
-rw-r--r-- | emacs.d/lisp/yasnippet/snippets/python-mode/while | 4 |
11 files changed, 174 insertions, 0 deletions
diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/.yas-parents b/emacs.d/lisp/yasnippet/snippets/python-mode/.yas-parents new file mode 100644 index 0000000..eed5b44 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/.yas-parents @@ -0,0 +1 @@ +text-mode diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/__ b/emacs.d/lisp/yasnippet/snippets/python-mode/__ new file mode 100644 index 0000000..a67dc49 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/__ @@ -0,0 +1,3 @@ +#name : __...__ +# -- +__${init}__
\ No newline at end of file diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/class b/emacs.d/lisp/yasnippet/snippets/python-mode/class new file mode 100644 index 0000000..72f339b --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/class @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# name: class +# contributor: Orestis Markou +# contributor: Nishio Hirokazu +# contributor: Yasser González Fernández <yglez@uh.cu> +# -- +class ${1:ClassName}(${2:object}): + """$3 + """ + + def __init__(self, $4): + """$5 + ${4:$ + (let* ((indent + (concat "\n" (make-string (current-column) 32))) + (args + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "- " (char-to-string 96) (nth 0 x) + (char-to-string 96) ":"))) + (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 "") + (make-string 3 34) + (mapconcat + 'identity + (list "" "Arguments:" args (make-string 3 34)) + indent))) + } + ${4:$ + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "self._" (nth 0 x) " = " (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 ","))) + (concat "\n" (make-string (current-column) 32))) + } + $0 diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/def b/emacs.d/lisp/yasnippet/snippets/python-mode/def new file mode 100644 index 0000000..f82f791 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/def @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# name: def +# contributor: Orestis Markou +# contributor: Yasser González Fernández <yglez@uh.cu> +# -- +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 "- " (char-to-string 96) (nth 0 x) + (char-to-string 96) ":"))) + (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 "") + (make-string 3 34) + (mapconcat + 'identity + (list "" "Arguments:" args (make-string 3 34)) + indent))) + } + $0 diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/defm b/emacs.d/lisp/yasnippet/snippets/python-mode/defm new file mode 100644 index 0000000..5b2aee4 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/defm @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# name: defm +# contributor: Yasser Gonz¨¢lez Fern¨¢ndez <yglez@uh.cu> +# -- +def ${1:name}(self, $2): + """$3 + ${2:$ + (let* ((indent + (concat "\n" (make-string (current-column) 32))) + (args + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "- " (char-to-string 96) (nth 0 x) + (char-to-string 96) ":"))) + (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 "") + (make-string 3 34) + (mapconcat + 'identity + (list "" "Arguments:" args (make-string 3 34)) + indent))) + } + $0 diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/for b/emacs.d/lisp/yasnippet/snippets/python-mode/for new file mode 100644 index 0000000..84f3ddd --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/for @@ -0,0 +1,4 @@ +#name : for ... in ... : ... +# -- +for ${var} in ${collection}: + $0
\ No newline at end of file diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/ifmain b/emacs.d/lisp/yasnippet/snippets/python-mode/ifmain new file mode 100644 index 0000000..6224923 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/ifmain @@ -0,0 +1,4 @@ +#name : if __name__ == '__main__': ... +# -- +if __name__ == '__main__': + $0
\ No newline at end of file diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/prop b/emacs.d/lisp/yasnippet/snippets/python-mode/prop new file mode 100644 index 0000000..107730a --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/prop @@ -0,0 +1,15 @@ +# contributor: Mads D. Kristensen <madsdk@gmail.com> +# name: prop +# -- +def ${1:foo}(): + doc = """${2:Doc string}""" + def fget(self): + return self._$1 + def fset(self, value): + self._$1 = value + def fdel(self): + del self._$1 + return locals() +$1 = property(**$1()) + +$0 diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/propg b/emacs.d/lisp/yasnippet/snippets/python-mode/propg new file mode 100644 index 0000000..63a9d98 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/propg @@ -0,0 +1,9 @@ +#contributor : Julio Carlos Menendez <godinblack@gmail.com> +#name : _get_foo ... foo=property(...) +# -- +def _get_${1:foo}(self): + return self._$1 + +$1 = property(_get_$1) + +$0 diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/propsg b/emacs.d/lisp/yasnippet/snippets/python-mode/propsg new file mode 100644 index 0000000..73f1690 --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/propsg @@ -0,0 +1,12 @@ +#contributor : Julio Carlos Menendez <godinblack@gmail.com> +#name : _get_foo ... _set_foo ... foo=property(...) +# -- +def _set_${1:foo}(self, value): + self._$1 = value + +def _get_$1(self): + return self._$1 + +$1 = property(_get_$1, _set_$1) + +$0 diff --git a/emacs.d/lisp/yasnippet/snippets/python-mode/while b/emacs.d/lisp/yasnippet/snippets/python-mode/while new file mode 100644 index 0000000..704dd7c --- /dev/null +++ b/emacs.d/lisp/yasnippet/snippets/python-mode/while @@ -0,0 +1,4 @@ +#name : while ... : ... +# -- +while ${condition}: + $0
\ No newline at end of file |