Replaced space indent through tab indent in snippets. This is more logical now that expandtab is adhered to

This commit is contained in:
Holger Rapp 2009-07-29 22:46:11 +02:00
parent 22804a2cbb
commit 51f462bbde
3 changed files with 30 additions and 30 deletions

View File

@ -9,13 +9,13 @@ snippet box "A nice box with the current comment symbol" b
c = '#' c = '#'
cs = vim.eval("&commentstring") cs = vim.eval("&commentstring")
if len(cs) == 3: if len(cs) == 3:
c = cs[0] c = cs[0]
res = (len(t[1])+4)*c + '\n' + c + ' '`${1:content}`!p res = (len(t[1])+4)*c + '\n' + c + ' '`${1:content}`!p
c = '#' c = '#'
cs = vim.eval("&commentstring") cs = vim.eval("&commentstring")
if len(cs) == 3: if len(cs) == 3:
c = cs[0] c = cs[0]
res = ' ' + c + '\n' + (len(t[1])+4)*c` res = ' ' + c + '\n' + (len(t[1])+4)*c`
$0 $0
@ -26,14 +26,14 @@ snippet bbox "A nice box over the full width" b
c = '#' c = '#'
cs = vim.eval("&commentstring") cs = vim.eval("&commentstring")
if len(cs) == 3: if len(cs) == 3:
c = cs[0] c = cs[0]
res = 75*c + '\n' + c + " "+ (71-len(t[1]))/2*' ' res = 75*c + '\n' + c + " "+ (71-len(t[1]))/2*' '
`${1:content}`!p `${1:content}`!p
c = '#' c = '#'
cs = vim.eval("&commentstring") cs = vim.eval("&commentstring")
if len(cs) == 3: if len(cs) == 3:
c = cs[0] c = cs[0]
a = 71-len(t[1]); res = (a/2 + a%2) * " " + " " + c + '\n' + 75*c` a = 71-len(t[1]); res = (a/2 + a%2) * " " + " " + c + '\n' + 75*c`
$0 $0

View File

@ -11,7 +11,7 @@ endsnippet
snippet ifmain "ifmain" b snippet ifmain "ifmain" b
if __name__ == '__main__': if __name__ == '__main__':
${1:main()}$0 ${1:main()}$0
endsnippet endsnippet
@ -20,13 +20,13 @@ endsnippet
########## ##########
snippet class "smart class" b snippet class "smart class" b
class ${1:MyClass}(${2:object}): class ${1:MyClass}(${2:object}):
"""${3:Docstring for $1}""" """${3:Docstring for $1}"""
def __init__( self${4/([^,])?(.*)/(?1:, )/}${4:arg} ): def __init__( self${4/([^,])?(.*)/(?1:, )/}${4:arg} ):
""" """
TODO: Fill me in TODO: Fill me in
${4/.+/(?0:\n)/}${4/(\A\s*,\s*\Z)|,?\s*([A-Za-z_][A-Za-z0-9_]*)\s*(=[^,]*)?(,\s*|$)/(?2: $2 - describe me here\n)/g} """ ${4/.+/(?0:\n)/}${4/(\A\s*,\s*\Z)|,?\s*([A-Za-z_][A-Za-z0-9_]*)\s*(=[^,]*)?(,\s*|$)/(?2:\t\t$2 - describe me here\n)/g}\t\t"""
${2/object$|(.+)/(?1: $0.__init__\(self\)\n\n)/}${4/(\A\s*,\s*\Z)|,?\s*([A-Za-z_][A-Za-z0-9_]*)\s*(=[^,]*)?(,\s*|$)/(?2: self._$2 = $2\n)/g} ${2/object$|(.+)/(?1:\t\t$0.__init__\(self\)\n\n)/}${4/(\A\s*,\s*\Z)|,?\s*([A-Za-z_][A-Za-z0-9_]*)\s*(=[^,]*)?(,\s*|$)/(?2:\t\tself._$2 = $2\n)/g}
endsnippet endsnippet
snippet . snippet .
@ -43,16 +43,16 @@ endsnippet
snippet roprop "Read Only Property" b snippet roprop "Read Only Property" b
@property @property
def ${1:property}(self): def ${1:property}(self):
${2:return self._$1}$0 ${2:return self._$1}$0
endsnippet endsnippet
snippet rwprop "Read write property" b snippet rwprop "Read write property" b
def ${1:property}(): def ${1:property}():
${2/.+/(?0:""")/}${2:The RW property $1}${2/.+/(?0:"""\n )/}def fget(self): ${2/.+/(?0:""")/}${2:The RW property $1}${2/.+/(?0:"""\n\t\t)/}def fget(self):
return self._$1$0 return self._$1$0
def fset(self, value): def fset(self, value):
self._$1 = value self._$1 = value
return locals() return locals()
$1 = property(**$1()) $1 = property(**$1())
endsnippet endsnippet
@ -61,38 +61,38 @@ endsnippet
########################## ##########################
snippet try "Try / Except" b snippet try "Try / Except" b
try: try:
${1:pass} ${1:pass}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
endsnippet endsnippet
snippet try "Try / Except / Else" b snippet try "Try / Except / Else" b
try: try:
${1:pass} ${1:pass}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
else: else:
${5:pass} ${5:pass}
endsnippet endsnippet
snippet try "Try / Except / Finally" b snippet try "Try / Except / Finally" b
try: try:
${1:pass} ${1:pass}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
else: else:
${5:pass} ${5:pass}
endsnippet endsnippet
snippet try "Try / Except / Else / Finally" b snippet try "Try / Except / Else / Finally" b
try: try:
${1:pass} ${1:pass}
except${2: ${3:Exception}, ${4:e}}: except${2: ${3:Exception}, ${4:e}}:
${5:raise} ${5:raise}
else: else:
${6:pass} ${6:pass}
finally: finally:
${7:pass} ${7:pass}
endsnippet endsnippet
############## ##############

View File

@ -12,7 +12,7 @@ endsnippet
snippet gvar "Global / configuration variable" snippet gvar "Global / configuration variable"
if !exists("g:${1:MyUltraImportantVar}") if !exists("g:${1:MyUltraImportantVar}")
let g:$1 = ${2:"${3:<tab>}"} let g:$1 = ${2:"${3:<tab>}"}
endif endif
endsnippet endsnippet