我的文字示例:
this is my text,this is,this is my text
this, this is my,this is my,this is text
我使用表格插件来对齐文本。
当我想在第一次和第二次出现单个空格时对齐时,'\s'
我使用这些行:
Tabularize /^\(.\{-}\zs\s\)\{1}/l0
Tabularize /^\(.\{-}\zs\s\)\{2}/l0
但是我注意到第一个对齐添加空格是为了对齐,但是第二个对齐会受到这些额外空格的影响,并且不是正确的工作。
我怎样才能避免这种情况?
(我希望我说清楚了)
编辑:
这是我所期望的:
this is my text,this is,this is my aatext
this, this is my,this is my,this is rtext
这是结果:
this is my text,this is,this is my aatext
this, this is my,this is my,this is rtext
编辑2:
这是我的示例,>= 2 个空格:
this is my text, this is,this is my aatext
this, this is my, this is my, this is rtext
改编 Nikita Kouevda 在他的回答中提出的代码:
Tabularize /\(^\(\(\S*\s\{2,}\)\{0}\|\(\S*\s\{2,}\)\{2}\)\)\@<=\S*\zs\s/l0
我期望:
this is my text, this is,this is my aatext
this, this is my, this is my, this is rtext
结果:
this is my text, this is,this is my aatext
this, this is my, this is my, this is rtext