【问题标题】:How I can prevent indentation after a line starting with a number?如何防止以数字开头的行后缩进?
【发布时间】:2016-09-02 08:46:13
【问题描述】:

我在 vim 的 RestructuredText 中遇到缩进问题。

当我写 RestructuredText (filetype=rst) 时,vim 会在以数字开头的行后面放置一些空格:

vim puts some space after line starting with a digit like even in mid sentence
9 something things are working and doing something and I need a new line to
  prove my point

每次我缩进当前段落时都会得到这个 (gqip)

有什么办法可以防止“证明”前面的空格吗?

【问题讨论】:

    标签: vim restructuredtext word-wrap


    【解决方案1】:

    我无法重现这个,但这看起来像一个组合

    :set formatoptions+=n formatlistpat=^\\d\\+\\s\\+
    

    我会通过更正'formatlistpat' 来解决这个问题;它应该只识别格式为1.1) 的数字(默认识别),而不是简单的数字。

    使用 :verbose set formatlistpat? 检查设置的位置,然后更改它,或覆盖 ~/.vim/after/ftplugin/rst.vim 中的 RST 文件类型。

    【讨论】:

    • 不知道单独在一个数字后缩进,但在一个数字或#行首后跟一个点(即9.#.) 在indent/rst.vim 文件中处理,它不能被禁用(不是完全放弃rst 缩进,也就是说)。大概是9.#. 开始枚举。
    猜你喜欢
    • 2018-07-14
    • 2011-02-15
    • 1970-01-01
    • 2019-11-05
    • 2018-11-06
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多