mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-16 10:24:18 +00:00
restructuring classic snippets dir to conform to new parenting specs
This commit is contained in:
1
snippets/python-mode/.yas-parents
Normal file
1
snippets/python-mode/.yas-parents
Normal file
@@ -0,0 +1 @@
|
||||
text-mode
|
||||
3
snippets/python-mode/__
Normal file
3
snippets/python-mode/__
Normal file
@@ -0,0 +1,3 @@
|
||||
#name : __...__
|
||||
# --
|
||||
__${init}__
|
||||
54
snippets/python-mode/class
Normal file
54
snippets/python-mode/class
Normal file
@@ -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
|
||||
35
snippets/python-mode/def
Normal file
35
snippets/python-mode/def
Normal file
@@ -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
|
||||
33
snippets/python-mode/defm
Normal file
33
snippets/python-mode/defm
Normal file
@@ -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
|
||||
4
snippets/python-mode/for
Normal file
4
snippets/python-mode/for
Normal file
@@ -0,0 +1,4 @@
|
||||
#name : for ... in ... : ...
|
||||
# --
|
||||
for ${var} in ${collection}:
|
||||
$0
|
||||
4
snippets/python-mode/ifmain
Normal file
4
snippets/python-mode/ifmain
Normal file
@@ -0,0 +1,4 @@
|
||||
#name : if __name__ == '__main__': ...
|
||||
# --
|
||||
if __name__ == '__main__':
|
||||
$0
|
||||
15
snippets/python-mode/prop
Normal file
15
snippets/python-mode/prop
Normal file
@@ -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
|
||||
9
snippets/python-mode/propg
Normal file
9
snippets/python-mode/propg
Normal file
@@ -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
|
||||
12
snippets/python-mode/propsg
Normal file
12
snippets/python-mode/propsg
Normal file
@@ -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
|
||||
4
snippets/python-mode/while
Normal file
4
snippets/python-mode/while
Normal file
@@ -0,0 +1,4 @@
|
||||
#name : while ... : ...
|
||||
# --
|
||||
while ${condition}:
|
||||
$0
|
||||
Reference in New Issue
Block a user