开发者

Using Tabularize plugin

How can modify this…

pt1 = [0, 1, 0]
pt2 = [0.588, -0.809, 0]
pt3 = [-0.951, 0.309, 0]
pt4 = [0.951, 0.309, 0]
pt5 = [-0.588, -0.809, 0]

…to make it look like this…

pt1 = [     0,      1, 0]
pt2 = [ 0.588, -0.809, 0]
pt3 = [-0.951,  0.309, 0]
p开发者_运维百科t4 = [ 0.951,  0.309, 0]
pt5 = [-0.588, -0.809, 0]

…using the Tabularize plugin? It's all about regular expressions and I could not find one that works in this case.


I make it this

:Tabularize /[,[]/l1c0r0c1r0c1r0

The spacing after the commas isn't quite right when I try Peter's suggestion, so I modified it slightly.


Not using the Tabularize plugin, but the Align plugin:

:'<,'>Align! Wp11000P00110 = [[] , , []]

Explanation:

  • You have 5 patterns on which to get alignment (=, [, ,, , and ]).
  • The first two must be padded with one space on the left (p11000)
  • The commas must be padded with one space after them (P00110)
  • W preserves indentation


This works nicely:

:Tabularize /[,[]/r1r0r0r0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜