我正在使用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.
然而,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.
我开启了自动缩进(autoindent),关闭了C样式的缩进(cindent),并且formatexpr是一个空字符串。我理解并喜欢C样式注释中自动插入星号的行为,但是想要不同的行为用于文本文件类型。有没有设置可以允许这样做?
gq
来按照你想要的格式化文本(这是我通常做的),但它似乎只适用于-
(而不是*
)。 - Martin Tournoij:set fo+=r comments=fb:*
可以满足你一半的需求。 - benjifisher