使用制表插件

发布于 2024-10-13 18:40:52 字数 455 浏览 7 评论 0原文

如何修改这个…

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]

…使其看起来像这样…

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]

…使用 Tabularize 插件?这都是关于正则表达式的,我找不到适合这种情况的正则表达式。

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]
pt4 = [ 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

皓月长歌 2024-10-20 18:40:52

当我尝试彼得的建议时,我把它设置

:Tabularize /[,[]/l1c0r0c1r0c1r0

为逗号后的间距不太正确,所以我稍微修改了它。

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.

沉默的熊 2024-10-20 18:40:52

不使用 Tabularize 插件,而是使用 Align 插件:

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

说明:

  • 您有 5 个要对齐的模式(=[])。
  • 前两个必须在左侧填充一个空格 (p11000)
  • 逗号后面必须填充一个空格 (P00110)
  • W保留缩进

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
吲‖鸣 2024-10-20 18:40:52

这很好用:

:Tabularize /[,[]/r1r0r0r0

This works nicely:

:Tabularize /[,[]/r1r0r0r0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文