Merge pull request #643 from dNItro/master
Add support to do transformation on multiple lines
This commit is contained in:
commit
0657e61e61
@ -1235,6 +1235,13 @@ The options can be any combination of >
|
|||||||
i - case insensitive
|
i - case insensitive
|
||||||
By default, regular expression matching is case sensitive. With this
|
By default, regular expression matching is case sensitive. With this
|
||||||
option, matching is done without regard to case.
|
option, matching is done without regard to case.
|
||||||
|
m - multiline
|
||||||
|
By default, the '^' and '$' special characters only apply to the
|
||||||
|
start and end of the entire string; so if you select multiple lines,
|
||||||
|
transformations are made on them entirely as a whole single line
|
||||||
|
string. With this option, '^' and '$' special characters match the
|
||||||
|
start or end of any line within a string ( separated by newline
|
||||||
|
character - '\n' ).
|
||||||
a - ascii conversion
|
a - ascii conversion
|
||||||
By default, transformation are made on the raw utf-8 string. With
|
By default, transformation are made on the raw utf-8 string. With
|
||||||
this option, matching is done on the corresponding ASCII string
|
this option, matching is done on the corresponding ASCII string
|
||||||
|
@ -124,6 +124,8 @@ class TextObjectTransformation(object):
|
|||||||
self._match_this_many = 0
|
self._match_this_many = 0
|
||||||
if 'i' in token.options:
|
if 'i' in token.options:
|
||||||
flags |= re.IGNORECASE
|
flags |= re.IGNORECASE
|
||||||
|
if 'm' in token.options:
|
||||||
|
flags |= re.MULTILINE
|
||||||
if 'a' in token.options:
|
if 'a' in token.options:
|
||||||
self._convert_to_ascii = True
|
self._convert_to_ascii = True
|
||||||
|
|
||||||
|
@ -179,6 +179,12 @@ class Transformation_OptionIgnoreCase_ECR(_VimTest):
|
|||||||
wanted = 'TEST blah'
|
wanted = 'TEST blah'
|
||||||
|
|
||||||
|
|
||||||
|
class Transformation_OptionMultiline_ECR(_VimTest):
|
||||||
|
snippets = ('test', r"${VISUAL/^/* /mg}")
|
||||||
|
keys = 'test\ntest\ntest' + ESC + 'V2k' + EX + 'test' + EX
|
||||||
|
wanted = '* test\n* test\n* test'
|
||||||
|
|
||||||
|
|
||||||
class Transformation_OptionReplaceGlobal_ECR(_VimTest):
|
class Transformation_OptionReplaceGlobal_ECR(_VimTest):
|
||||||
snippets = ('test', r"$1 ${1/, */-/g}")
|
snippets = ('test', r"$1 ${1/, */-/g}")
|
||||||
keys = 'test' + EX + 'a, nice, building'
|
keys = 'test' + EX + 'a, nice, building'
|
||||||
|
Loading…
Reference in New Issue
Block a user