在 VIM 中格式化列表
我想找到一种在 Vim 中轻松格式化列表的方法。
我检查了 PAR 和 Vim 的默认格式化程序。
pe
1. this is my text this is my text this is my text 2. this is my text this is my text this is my text 3. this is my text this is my text this is my text 4. this is my text this is my text this is my text
和
- this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text
当我选择行并使用 PAR 和 VIM 将默认格式设置为 42 时,结果如下:
NUMBERED LIST
formatting with par:
参数错误:
(42) <= (0) + (50)
使用 vim 格式化:
1. this is my text this is my text this is my text 2. this is my text this is my text this is my text 3. this is my text this is my text this is my text 4. this is my text this is my text this is my text
带 '-' 的 LIST
使用 par 格式化:
过滤了 4 行(没有变化)
使用 vim 格式化:
- this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text
Vim does a better job formatting lists but it is not correct as well in a numbered list.
Par does have a lot of troubles formatting lists even when I use the prefix ("p") option like this:
'<,'>!par w42p4dh or '<,'>!par w42p3dh
有谁知道如何毫无问题地格式化列表的好方法?
I would like to find a way to easy format lists in Vim.
I checked PAR and the default formatter of Vim.
p.e.
1. this is my text this is my text this is my text 2. this is my text this is my text this is my text 3. this is my text this is my text this is my text 4. this is my text this is my text this is my text
and this
- this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text
when I select the lines and do a default format to 42 with PAR and VIM these are the results:
NUMBERED LIST
formatting with par:
par error:
(42) <= (0) + (50)
formatting with vim:
1. this is my text this is my text this is my text 2. this is my text this is my text this is my text 3. this is my text this is my text this is my text 4. this is my text this is my text this is my text
LIST with '-'
formatting with par:
4 lines filtered (no change)
formatting with vim:
- this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text - this is my text this is my text this is my text
Vim does a better job formatting lists but it is not correct as well in a numbered list.
Par does have a lot of troubles formatting lists even when I use the prefix ("p") option like this:
'<,'>!par w42p4dh or '<,'>!par w42p3dh
Does anyone know a good way how to format lists without problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
设置 fo+=n
。来自:help fo-table
:Try
set fo+=n
. From:help fo-table
: