我最近从使用 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 中重新格式化这些表格吗?