Added box snippets for python. Added a test case for completion inside of snippets

This commit is contained in:
Holger Rapp 2009-07-15 18:16:42 +02:00
parent 717ae7586c
commit 7a34de5613
2 changed files with 33 additions and 0 deletions

View File

@ -6,6 +6,24 @@ 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 #
########## ##########

15
test.py
View File

@ -20,6 +20,10 @@ JF = "?" # Jump forwards
JB = "+" # Jump backwards JB = "+" # Jump backwards
EX = "\t" # EXPAND EX = "\t" # EXPAND
# Some VIM functions
COMPL_KW = chr(24)+chr(14)
COMPL_ACCEPT = chr(25)
def send(s,session): def send(s,session):
os.system("screen -x %s -X stuff '%s'" % (session,s)) os.system("screen -x %s -X stuff '%s'" % (session,s))
@ -757,6 +761,17 @@ class ProperIndenting_AutoIndentAndNewline_ECR(_VimTest):
self.send(":set noautoindent\n") self.send(":set noautoindent\n")
_VimTest.tearDown(self) _VimTest.tearDown(self)
####################
# COMPLETION TESTS #
####################
class Completion_SimpleExample_ECR(_VimTest):
snippets = ("test", "$1 ${1:blah}")
keys = "superkallifragilistik\ntest" + EX + "sup" + COMPL_KW + \
COMPL_ACCEPT + " some more"
wanted = "superkallifragilistik\nsuperkallifragilistik some more " \
"superkallifragilistik some more"
###################### ######################
# SELECTING MULTIPLE # # SELECTING MULTIPLE #