1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2013-07-17 19:06:05 -04:00
parent 879a7b6bd4
commit a448b32309
85 changed files with 2174 additions and 941 deletions

View File

@ -2,29 +2,33 @@ snippet #!
#!/usr/bin/env python
snippet imp
import ${1:module}
snippet uni
def __unicode__(self):
${1:representation}
snippet from
from ${1:package} import ${2:module}
# Module Docstring
snippet docs
"""
File: ${1:`Filename('$1.py', 'foo.py')`}
File: ${1:`vim_snippets#Filename('$1.py', 'foo.py')`}
Author: `g:snips_author`
Email: `g:snips_email`
Github: `g:snips_github`
Description: ${2}
"""
snippet wh
while ${1:condition}:
${2:# TODO: write code...}
${2}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
${1:# TODO: write code...}
${1}
if ${2:condition}:
break
snippet with
with ${1:expr} as ${2:var}:
${3:# TODO: write code...}
${3}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
@ -37,14 +41,14 @@ snippet cl
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${4:# TODO: write code...}
${4}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${3:# TODO: write code...}
${3}
# New Method
snippet defs
def ${1:mname}(self, ${2:arg}):
${3:# TODO: write code...}
${3}
# New Property
snippet property
def ${1:foo}():
@ -60,17 +64,17 @@ snippet property
# Ifs
snippet if
if ${1:condition}:
${2:# TODO: write code...}
${2}
snippet el
else:
${1:# TODO: write code...}
${1}
snippet ei
elif ${1:condition}:
${2:# TODO: write code...}
${2}
# For
snippet for
for ${1:item} in ${2:items}:
${3:# TODO: write code...}
${3}
# Encodes
snippet cutf8
# -*- coding: utf-8 -*-
@ -79,38 +83,38 @@ snippet clatin1
snippet cascii
# -*- coding: ascii -*-
# Lambda
snippet lda
snippet ld
${1:var} = lambda ${2:vars} : ${3:action}
snippet .
self.
snippet try Try/Except
try:
${1:# TODO: write code...}
${1}
except ${2:Exception}, ${3:e}:
${4:raise $3}
snippet try Try/Except/Else
try:
${1:# TODO: write code...}
${1}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:# TODO: write code...}
${5}
snippet try Try/Except/Finally
try:
${1:# TODO: write code...}
${1}
except ${2:Exception}, ${3:e}:
${4:raise $3}
finally:
${5:# TODO: write code...}
${5}
snippet try Try/Except/Else/Finally
try:
${1:# TODO: write code...}
${1}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:# TODO: write code...}
${5}
finally:
${6:# TODO: write code...}
${6}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
@ -127,6 +131,9 @@ snippet ipdb
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.set_trace()
# python console debugger (pudb)
snippet pudb
import pudb; pudb.set_trace()
snippet pprint
import pprint; pprint.pprint(${1})${2}
snippet "
@ -136,13 +143,13 @@ snippet "
# test function/method
snippet test
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
${3:# TODO: write code...}
${3}
# test case
snippet testcase
class ${1:ExampleCase}(unittest.TestCase):
def test_${2:description}(self):
${3:# TODO: write code...}
${3}
snippet fut
from __future__ import ${1}
#getopt
@ -151,7 +158,7 @@ snippet getopt
# Short option syntax: "hv:"
# Long option syntax: "help" or "verbose="
opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}])
except getopt.GetoptError, err:
# Print debug info
print str(err)
@ -169,7 +176,8 @@ snippet glog
logger = logging.getLogger(${1:__name__})
snippet le
logger.error(${1:msg})
snippet ld
# conflict with lambda=ld, therefor we change into Logger.debuG
snippet lg
logger.debug(${1:msg})
snippet lw
logger.warning(${1:msg})