parent
d693259abb
commit
81a628c6ea
@ -649,6 +649,11 @@ The options currently supported are: >
|
|||||||
before jumping to the next tabstop. This is useful if there is a
|
before jumping to the next tabstop. This is useful if there is a
|
||||||
tabstop with optional text at the end of a line.
|
tabstop with optional text at the end of a line.
|
||||||
|
|
||||||
|
m Trim all whitespaces from right side of snippet lines. Practically
|
||||||
|
useful when snippet contains empty lines which should remain empty
|
||||||
|
after expanding on some indentation level. Without this option
|
||||||
|
empty lines in snippets definition will have indentation too.
|
||||||
|
|
||||||
The end line is the 'endsnippet' keyword on a line by itself. >
|
The end line is the 'endsnippet' keyword on a line by itself. >
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -228,7 +228,10 @@ class SnippetDefinition(object):
|
|||||||
if line_num != 0:
|
if line_num != 0:
|
||||||
line_ind = indent + line_ind
|
line_ind = indent + line_ind
|
||||||
|
|
||||||
initial_text.append(line_ind + line[tabs:])
|
result_line = line_ind + line[tabs:]
|
||||||
|
if 'm' in self._opts:
|
||||||
|
result_line = result_line.rstrip()
|
||||||
|
initial_text.append(result_line)
|
||||||
initial_text = '\n'.join(initial_text)
|
initial_text = '\n'.join(initial_text)
|
||||||
|
|
||||||
snippet_instance = SnippetInstance(
|
snippet_instance = SnippetInstance(
|
||||||
|
@ -47,6 +47,16 @@ class RemoveTrailingWhitespace(_VimTest):
|
|||||||
wanted = """Hello\nGoodbye"""
|
wanted = """Hello\nGoodbye"""
|
||||||
keys = 'test' + EX + BS + JF + 'Goodbye'
|
keys = 'test' + EX + BS + JF + 'Goodbye'
|
||||||
|
|
||||||
|
class TrimSpacesAtEndOfLines(_VimTest):
|
||||||
|
snippets = ('test', """next line\n\nshould be empty""", '', 'm')
|
||||||
|
wanted = """\tnext line\n\n\tshould be empty"""
|
||||||
|
keys = '\ttest' + EX
|
||||||
|
|
||||||
|
class DoNotTrimSpacesAtEndOfLinesByDefault(_VimTest):
|
||||||
|
snippets = ('test', """next line\n\nshould be empty""", '', '')
|
||||||
|
wanted = """\tnext line\n\t\n\tshould be empty"""
|
||||||
|
keys = '\ttest' + EX
|
||||||
|
|
||||||
|
|
||||||
class LeaveTrailingWhitespace(_VimTest):
|
class LeaveTrailingWhitespace(_VimTest):
|
||||||
snippets = ('test', """Hello \t ${1:default}\n$2""")
|
snippets = ('test', """Hello \t ${1:default}\n$2""")
|
||||||
|
Loading…
Reference in New Issue
Block a user