关于Vim中文本格式的问题

我正在使用Vim来编写不是代码的文本,只是写自由形式.要做到这一点,我喜欢格式化选项包括w标志,有时还包括标志.

当一行以非空白字符结尾而不是第一个空白行(默认为Vim)时,w标志应该使它成为段落结尾.以下是帮助文档中的代码段:

w   Trailing white space indicates a paragraph continues in the next line.
    A line that ends in a non-white character ends a paragraph.

在您键入时,a标志会自动重新格式化.例如,在下面带有文本的文档中,w和一个标记行重新格式化,因为我只键入“段落中的最后一行”而不是下面.

This it the first line of the paragraph. <cr>
The text in it reformats properly as I type <cr>
up to the last line of the paragraph, which is <cr>
right after this line, that is, just below here: <cr>
This is the last line of paragraph.<cr>
This is the first line of second paragraph. <cr>
Even though there is no blank line between <cr>
it and first paragraph, any reformatting of <cr>
the first paragraph ends at the last line <cr>
of first paragraph.<cr>
<cr>
This the the first line after second paragraph<cr>

现在问我的问题:
使用a和w标志,当我输入第一段时,重新格式化正常工作,即第二段保持不变.但有时我想用vap选择当前段落.在我看来,使用w标志设置,这应该只选择第一段.但实际上在第一段中发出vap也会选择第二段,一直到< cr>的空白行,似乎忽略了w formatoptions标志.

这是预期的行为吗?我错过了什么吗?为什么vap不能只选择我所在的段落,该段落在第一行没有尾随空格?

最佳答案 如果您阅读以下内容的帮助:h段,则不提及’fo’设置.所以

貌似fo设置并没有真正改变,是什么定义了一个段落.这可能是一个错误或不清楚的文档,所以你可能想在vim-dev邮件列表上讨论这个问题.

点赞