Vim 中的 Multimarkdown 表格格式

Jez*_*Jez 16 vim markdown

我最近从使用 TextMate 转移到更多地使用 Vim(因为我在 Mac 和 Linux 之间分配时间)。我想念的一件事是美妙的 MultiMarkdown 包,除了其他功能外,它让我可以用 MultiMarkdown 语法输入表格,然后重新格式化它们,使它们看起来很漂亮。

所以,例如这个:

| Heading 1 | Heading 2 | Heading 3 |
| --: | -- | -- |
| 1 | Some text | Some other text |
| 2 | A somewhat longer piece of text | Further text |
Run Code Online (Sandbox Code Playgroud)

变成这样:

| Heading 1 | Heading 2                       | Heading 3       |
| --------: | ------------------------------- | --------------- |
|         1 | Some text                       | Some other text |
|         2 | A somewhat longer piece of text | Further text    |
Run Code Online (Sandbox Code Playgroud)

我发现的最接近的是table_format.vim,但它已经很旧了,并且使用空格而不是竖线来分隔列。

有什么更好的方法可以在 Vim 中重新格式化这些表格吗?

小智 11

对齐插件可以用竖线使用快捷表格式“\ T |”。


Jez*_*Jez 7

我现在也遇到了Tabular.vim,它是另一个与 Align.vim 相同的插件。它们很相似,但在工作方式上各有优缺点。