neosnippet.vim/neosnippets/python.snip

120 lines
2.2 KiB
Plaintext
Raw Normal View History

2012-02-02 04:33:35 +00:00
snippet class
abbr class Class(...): ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
class ${1:#:name}(${2:#:object}):
2012-10-01 04:25:38 +00:00
def __init__(self, ${3}):
${0}
snippet classd
abbr class Class(...): "..."
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
class ${1:#:name}(${2:#:object}):
"""${3:#:class documentation}"""
2012-02-02 04:33:35 +00:00
def __init__(self, ${4}):
2012-10-29 20:11:23 +00:00
"""${5:#:__init__ documentation}"""
2012-10-01 04:25:38 +00:00
${0}
2012-02-02 04:33:35 +00:00
snippet def
abbr def function(...): ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
def ${1:#:name}(${2}):
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-10-01 04:25:38 +00:00
snippet defd
abbr def function(...): """..."""
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
def ${1:#:name}(${2}):
"""${3:#:function documentation}"""
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
snippet defm
abbr def method(self, ...): ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
def ${1:#:name}(self, ${2}):
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-10-01 04:25:38 +00:00
snippet defmd
abbr def method(self, ...): "..."
2012-10-21 12:13:26 +00:00
options head
2012-10-30 08:53:14 +00:00
def ${1:#:name}(self, ${2}):
2012-10-29 20:11:23 +00:00
"""${3:#:method documentation}"""
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
snippet elif
abbr elif ...: ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
elif ${1:#:condition}:
2012-10-01 04:25:38 +00:00
${0}
2012-02-02 04:33:35 +00:00
snippet else
abbr else: ...
2012-10-21 12:13:26 +00:00
options head
2012-02-02 04:33:35 +00:00
else:
2012-10-01 04:25:38 +00:00
${0}
2012-02-02 04:33:35 +00:00
snippet fileidiom
abbr f = None try: f = open(...) finally: ...
2012-10-21 12:13:26 +00:00
options head
2012-02-02 04:33:35 +00:00
${1:f} = None
try:
$1 = open(${2})
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
finally:
if $1:
$1.close()
snippet for
abbr for ... in ...: ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
for ${1:#:value} in ${2:#:list}:
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
snippet if
abbr if ...: ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
if ${1:#:condition}:
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
snippet ifmain
abbr if __name__ == '__main__': ...
2013-06-26 03:43:18 +00:00
alias main
2012-10-21 12:13:26 +00:00
options head
2012-02-02 04:33:35 +00:00
if __name__ == '__main__':
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
snippet tryexcept
abbr try: ... except ...: ...
2012-10-21 12:13:26 +00:00
options head
2012-02-02 04:33:35 +00:00
try:
2012-10-30 08:53:14 +00:00
${1:TARGET}
2012-10-29 20:11:23 +00:00
except ${2:#:ExceptionClass}:
2012-10-01 04:25:38 +00:00
${3}
2012-02-02 04:33:35 +00:00
snippet tryfinally
abbr try: ... finally: ...
2012-10-21 12:13:26 +00:00
options head
2012-02-02 04:33:35 +00:00
try:
2012-10-30 08:53:14 +00:00
${1:TARGET}
2012-02-02 04:33:35 +00:00
finally:
2012-10-01 04:25:38 +00:00
${2}
2012-02-02 04:33:35 +00:00
snippet while
abbr while ...: ...
2012-10-21 12:13:26 +00:00
options head
2012-10-29 20:11:23 +00:00
while ${1:#:condition}:
2012-10-30 08:53:14 +00:00
${0:TARGET}
2012-10-01 04:25:38 +00:00
2012-11-02 08:54:48 +00:00
snippet with
abbr with open({file}) as :
options head
2012-11-02 08:58:54 +00:00
with open(${1:#:filename, mode}) as f:
2012-11-02 08:54:48 +00:00
${0:TARGET}
snippet filter
abbr [x for x in {list} if {condition}]
[$1 for ${1:x} in ${2:#:list} if ${3:#:condition}]
2013-06-26 03:43:18 +00:00
snippet print
options word
print(${0:TARGET})