Vim:没有前导字符的Textwrap

Faz*_*ton 11 vim word-wrap autoformatting

我正在VIM中编写一个弹出的列表,并设置textwidth = 79来硬包装线.当我写清单时,我希望每个回车都能产生一个新的子弹,并且包裹的线条没有子弹.然而,VIM正在做相反的事情(包裹线上的子弹,回车后没有子弹).我想要:

* Item 1 - The text for this line is too long and
  so is wrapped to the next line.
* Item 2 - Typing a carriage return after item 1
  should produce the bullet for this item.
Run Code Online (Sandbox Code Playgroud)

但是,VIM会这样做:

* Item 1 - The text for this line is too long and
* so is wrapped to the next line.
Item 2 - Typing a carriage return after item 1
should produce the bullet for this line.
Run Code Online (Sandbox Code Playgroud)

我有autoindent,cindent off,而formatexpr是一个空字符串.我理解并喜欢C风格注释的自动插入'*'行为,但是想要文本文件类型的不同行为.有没有允许这样的设置?

Geo*_*edy 1

尝试

set formatoptions=tn autoindent
let &formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[*-]\s\)\s*'
Run Code Online (Sandbox Code Playgroud)

formatoptions 中的n标志会触发您要处理的列表的格式,但 formatlistpat 的默认设置仅处理编号列表。*上面添加了 或之一的项目符号-