vim indentation:禁用枚举列表的推断

时间:2017-09-06 09:11:54

标签: vim indentation

在vim中,当我使用gqip在纯文本文件中格式化以下段落时,格式化程序将其缩进为枚举列表。

原始段落:

Here is some text including a number
3 in the paragraph, which may be
regarded as the start of a numbered
list when I format it. 

格式化(gqip之后):

Here is some text including a number
3 in the paragraph, which may be
  regarded as the start of a numbered
list when I format it. 

问题在于,vim将“被视为”一词对齐,好像“段落中的第3行......”某某意味着“(3)在段落中”。在我看来,这是格式规则中的一个错误,因为在普通文本中经常会出现明显的反例。那么如何才能优化此缩进规则,以便仅在数字上存在类似列表的标点符号时应用?例如,我认为这没关系:

Here is some text including a number
3) in the paragraph, which may be
   regarded as the start of a numbered
list when I format it. 

此规则也有反例,但至少错误的发生频率较低。通过检查平衡括号可以进一步改进规则 - 即:

Here is some text (including a number
3) in the paragraph, which is not
regarded as the start of a numbered
list when I format it (because the 
parenthesis is accounted for by the
opening parenthesis on line 1). 

1 个答案:

答案 0 :(得分:1)

请参阅:h fo-table的{​​{1}}字母含义,然后参阅用于识别列表标题的n

:h formatlistpat