我想找到一种在 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)
用 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
用 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
有没有人知道如何毫无问题地格式化列表的好方法?
最佳答案
尝试设置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
https://stackoverflow.com/questions/6731794/
相关文章:
c# - 支持自定义数字类型的 ToString(字符串格式)
javascript - Number().toLocaleString() 在不同的浏览器中有不同
scala - Intellij Scala 多种导入样式格式设置
python - 我们应该为 python 变量名使用哪些缩写?
android - 如何在 Intellij IDEA 13 for android 中按字母顺序对
c++ - 你如何设置 cout 语言环境来插入逗号作为千位分隔符?
c# - String.Format 没有正确转换阿拉伯语的整数