如何让vim用正确的缩进格式化项目符号列表

时间:2011-09-02 10:46:19

标签: vim

在vim中,我可以设置textwidth选项,然后将新文本格式化为wrap。我也可以使用“gq”命令来显式包装文本。但是,使用项目符号列表的行为对我来说有点意外。 vim文档讨论了使用带有连字符的项目符号的项目符号列表。当我尝试这样做时,它就开始了:

- This is a bulleted list item that
  has been wrapped. It looks good.

但是,如果我继续第三行,它会放弃缩进:

- This is a bulleted list item that
  has been wrapped over more than
two lines. The indentation for lines
after the second is unexpected.

这发生在:

formatoptions=tcq
comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-

为了清楚起见,我想这样缩进:

- This is a bulleted list item that
  has been wrapped over more than
  two lines. I want every line after
  the first to get the same indent.

1 个答案:

答案 0 :(得分:7)

经过进一步调查,看起来我只需要“设置自动注册”来获得预期的行为。这似乎适用于文本包装和键入“gq”命令。