【问题标题】:Vim not breaking line when adding text at the beginningVim 在开头添加文本时不换行
【发布时间】:2017-02-05 07:34:48
【问题描述】:

我将textwidth=20 设置为让 Vim 自动换行,它工作正常,如下所示:

1 1234 1234 1234 1234
2 1234 1234 1234 1234
3 1234 1234 1234 1234

但是,当我转到第 2 行的开头并添加一些文本时,该行没有中断,如下所示:

1 1234 1234 1234 1234
2 1234 1234 1234 1234 1234 1234 1234 1234
3 1234 1234 1234 1234

然后我必须使用gqap 来更正给出的宽度:

1 1234 1234 1234 1234
2 1234 1234 1234 1234
3 1234 1234 1234 1234
@987654332@12434 34234 12p>

在行首添加文本时有什么方法可以自动换行吗?

【问题讨论】:

    标签: vim editor text-editor


    【解决方案1】:

    您正在寻找的是auto-format。见:h auto-format

    :set formatoptions+=a
    

    当“formatoptions”中出现“a”标志时,文本被格式化 插入文本或删除文本时自动进行。

    【讨论】:

      猜你喜欢
      • 2016-07-22
      • 2013-12-03
      • 2011-04-15
      • 2018-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-11
      • 1970-01-01
      相关资源
      最近更新 更多