Added vim module into imported python modules for python interpolation. box and bbox are now in the all.snippets and use the comment leader extracted from the commentstring option
This commit is contained in:
parent
8e46b5ba11
commit
94ee96cb31
@ -1,3 +1,43 @@
|
|||||||
# This file contains snippets that are always defined. I personally
|
# This file contains snippets that are always defined. I personally
|
||||||
# have snippets for signatures and often needed texts
|
# have snippets for signatures and often needed texts
|
||||||
|
|
||||||
|
##############
|
||||||
|
# NICE BOXES #
|
||||||
|
##############
|
||||||
|
snippet box
|
||||||
|
`!p
|
||||||
|
c = '#'
|
||||||
|
cs = vim.eval("&commentstring")
|
||||||
|
if len(cs) == 3:
|
||||||
|
c = cs[0]
|
||||||
|
|
||||||
|
res = (len(t[1])+4)*c + '\n' + c + ' '`${1:content}`!p
|
||||||
|
c = '#'
|
||||||
|
cs = vim.eval("&commentstring")
|
||||||
|
if len(cs) == 3:
|
||||||
|
c = cs[0]
|
||||||
|
|
||||||
|
res = ' ' + c + '\n' + (len(t[1])+4)*c`
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet bbox
|
||||||
|
`!p
|
||||||
|
c = '#'
|
||||||
|
cs = vim.eval("&commentstring")
|
||||||
|
if len(cs) == 3:
|
||||||
|
c = cs[0]
|
||||||
|
|
||||||
|
res = 75*c + '\n' + c + " "+ (71-len(t[1]))/2*' '
|
||||||
|
`${1:content}`!p
|
||||||
|
c = '#'
|
||||||
|
cs = vim.eval("&commentstring")
|
||||||
|
if len(cs) == 3:
|
||||||
|
c = cs[0]
|
||||||
|
|
||||||
|
a = 71-len(t[1]); res = (a/2 + a%2) * " " + " " + c + '\n' + 75*c`
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,23 +14,6 @@ if __name__ == '__main__':
|
|||||||
${1:main()}$0
|
${1:main()}$0
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
##############
|
|
||||||
# NICE BOXES #
|
|
||||||
##############
|
|
||||||
snippet box
|
|
||||||
`!p res = (len(t[1])+4)*"#"`
|
|
||||||
# ${1:content} #
|
|
||||||
`!p res = (len(t[1])+4)*"#"`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bbox
|
|
||||||
`!p res = 75*"#"`
|
|
||||||
# `!p res = (71-len(t[1]))/2*' '`${1:content}`!p a = 71-len(t[1]); res = (a/2 + a%2) * " " ` #
|
|
||||||
`!p res = 75*"#"`
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
|
|
||||||
##########
|
##########
|
||||||
# COMMON #
|
# COMMON #
|
||||||
|
@ -626,7 +626,7 @@ class PythonCode(TextObject):
|
|||||||
code = code.replace("\\`", "`")
|
code = code.replace("\\`", "`")
|
||||||
|
|
||||||
# Add Some convenience to the code
|
# Add Some convenience to the code
|
||||||
self._code = "import re, os\n" + code.strip()
|
self._code = "import re, os, vim\n" + code.strip()
|
||||||
|
|
||||||
TextObject.__init__(self, parent, start, end, "")
|
TextObject.__init__(self, parent, start, end, "")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user