Use actual value for SINGLE_QUOTES/DOUBLE_QUOTES

This commit is contained in:
Daniel Hahler 2014-06-17 22:52:46 +02:00
parent c7c1734b44
commit 3514b3cb44

View File

@ -36,8 +36,8 @@ DOXYGEN = 0x2
SPHINX = 0x3
GOOGLE = 0x4
SINGLE_QUOTES = 0x1
DOUBLE_QUOTES = 0x2
SINGLE_QUOTES = "'"
DOUBLE_QUOTES = '"'
class Arg(object):
@ -69,9 +69,28 @@ def get_quoting_style(snip):
return DOUBLE_QUOTES
def triple_quotes(snip):
if get_quoting_style(snip) == SINGLE_QUOTES:
return "'''"
return '"""'
return get_quoting_style(snip) * 3
def triple_quotes_handle_trailing(snip, quoting_style):
if not hasattr(snip, '_tqt'):
_, col = vim.current.window.cursor
line = vim.current.line
# Handle already existing quote chars, usually from an autoclose plugin
# like delimitMate.
_ret = quoting_style * 3
while True:
try:
nextc = line[col]
except IndexError:
break
if nextc == quoting_style and len(_ret):
_ret = _ret[1:]
col = col+1
else:
break
snip._tqt = _ret
snip.rv = snip._tqt
def get_style(snip):
style = snip.opt("g:ultisnips_python_style", "normal")