加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

关于Vim中文本格式的问题

发布时间:2020-12-15 20:55:27 所属栏目:安全 来源:网络整理
导读:我正在使用Vim来编写不是代码的文本,只是写自由形式.要做到这一点,我喜欢格式化选项包括w标志,有时还包括标志. 当一行以非空白字符结尾而不是第一个空白行(默认为Vim)时,w标志应该使它成为段落结尾.以下是帮助文档中的代码段: w Trailing white space indic
我正在使用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邮件列表上讨论这个问题.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读