【发布时间】:2013-06-12 19:47:18
【问题描述】:
例子:
this is my text, this is, this is my text
this, this is my, this is my, this is text
this is, my text, this is, this is my text
this, this is my, this is my, this is text
通常,我使用Tabular 插件来对齐文本。
体育在','的第一次或第二次出现对齐
我用这个公式:
Tabularize /^\(.\{-}\zs,\)\{1}/l0
Tabularize /^\(.\{-}\zs,\)\{2}/l0
并在',' 的第一次或第二次出现后对齐
Tabularize /^\(.\{-}\zs,\)\{1}\zs/l0l1
Tabularize /^\(.\{-}\zs,\)\{2}\zs/l0l1
但是我如何对齐 *',' 的最后一次出现 * 和之后
如果我不知道有多少次出现?
【问题讨论】:
-
您可以将您的模式锚定到行尾。
-
@romainl 锚到行尾?
-
不要让模式从行首 (
^) 开始,而是从行尾开始工作。 -
@romainl,我无法让它工作。能给我举个例子吗?我必须在
\{1}中输入什么? -
在不知道您要查找的确切输出的情况下,我认为
.*,应该在最后一个逗号之后对齐。
标签: regex vim text alignment tabular