gpt4 book ai didi

list - VIM 中的格式化列表

转载 作者:bug小助手 更新时间:2023-10-28 10:49:44 25 4
gpt4 key购买 nike

我想找到一种在 Vim 中轻松格式化列表的方法。
我检查了 PAR 和 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  

还有这个

- 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 时,结果如下:


编号列表

用 par 格式化:
标准错误:
(42) <= (0) + (50)

用 vim 格式化:

1. this is my text this is my text this ismy text 2. this is my text this is my text this ismy text 3. this is my text this is my text this ismy text 4. this is my text this is my text this is   my text 

带有'-'的列表

用 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 在格式化列表方面做得更好,但在编号列表中也不正确。
即使我像这样使用前缀 ("p") 选项,Par 在格式化列表时也会遇到很多麻烦:
'<,'>!par w42p4dh 或 '<,'>!par w42p3dh

有没有人知道如何毫无问题地格式化列表的好方法?

最佳答案

尝试设置fo+=n。来自 :help fo-table:

n       When formatting text, recognize numbered lists.  This actually uses
the 'formatlistpat' option, thus any kind of list can be used. The
indent of the text after the number is used for the next line. The
default is to find a number, optionally followed by '.', ':', ')',
']' or '}'. Note that 'autoindent' must be set too. Doesn't work
well together with "2".

Example:
1. the first item
wraps
2. the second item

关于list - VIM 中的格式化列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6731794/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com