vim: adjust Python snippets
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 14 May 2010 23:31:19 -0400 |
parents |
38e1948a9e83
|
children |
f649ee3b770a
|
branches/tags |
(none) |
files |
.hgignore vim/bundle/snipMate/snippets/python.snippets |
Changes
--- a/.hgignore Fri May 14 20:31:27 2010 -0400
+++ b/.hgignore Fri May 14 23:31:19 2010 -0400
@@ -4,3 +4,4 @@
*.pyc
.netrwhist
*.swp
+tags
--- a/vim/bundle/snipMate/snippets/python.snippets Fri May 14 20:31:27 2010 -0400
+++ b/vim/bundle/snipMate/snippets/python.snippets Fri May 14 23:31:19 2010 -0400
@@ -1,52 +1,29 @@
snippet #!
- #!/usr/bin/python
-
-snippet imp
- import ${1:module}
-# Module Docstring
-snippet docs
- '''
- File: ${1:`Filename('$1.py', 'foo.py')`}
- Author: ${2:`g:snips_author`}
- Description: ${3}
- '''
-snippet wh
- while ${1:condition}:
- ${2:# code...}
+ #!/usr/bin/env python
+snippet from
+ from ${1:sys} import ${2:*}
+snippet while
+ while ${1:True}:
+ ${2:pass}
snippet for
- for ${1:needle} in ${2:haystack}:
- ${3:# code...}
-# New Class
-snippet cl
+ for ${1:x} in ${2:xs}:
+ ${3:pass}
+snippet fore
+ for ${1:n}, ${2:item} in enumerate(${3:items}):
+ ${4:pass}
+snippet class
class ${1:ClassName}(${2:object}):
- """${3:docstring for $1}"""
- def __init__(self, ${4:arg}):
- ${5:super($1, self).__init__()}
- self.$4 = $4
- ${6}
-# New Function
+ def __init__(self${3:, args}):
+ ${4:super($1, self).__init__()}
+ ${5}
snippet def
- def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
- """${3:docstring for $1}"""
- ${4:pass}
-snippet deff
- def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
- ${3}
-# New Method
-snippet defs
- def ${1:mname}(self, ${2:arg}):
+ def ${1:function}(${2}):
${3:pass}
-# New Property
-snippet property
- def ${1:foo}():
- doc = "${2:The $1 property.}"
- def fget(self):
- ${3:return self._$1}
- def fset(self, value):
- ${4:self._$1 = value}
-# Lambda
-snippet ld
- ${1:var} = lambda ${2:vars} : ${3:action}
+snippet defs
+ def ${1:method}(self${2}):
+ ${3:pass}
+snippet lam
+ lambda ${1:args}: ${2:action}
snippet .
self.
snippet try Try/Except
@@ -77,10 +54,10 @@
${5:pass}
finally:
${6:pass}
-# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
${1:main()}
-# __magic__
snippet _
__${1:init}__${2}
+snippet ***
+ *args, **kwargs