Vim:`set formatoptions` 丢失了吗? [英] Vim: `set formatoptions` being lost?
问题描述
我的 vimrc
中有 set formatoptions=cqn
,但由于某种原因它不坚持.Vim 似乎在某个时候恢复到默认值 (fo=tcq
)……但我不知道为什么.运行 -V100/tmp/log
只会给我:
formatoptions=tcq最后一组来自 ~/.vimrc
没有有用的上下文.
那么,有没有办法让 formatoptions 坚持下去?或者我是否只需要创建一个 autocmd 来在每次加载新文件时重置它?
编辑
使用 :verbose set formatoptions
显示:
然而,在我的 ~/.vimrc 中对 fo
或 formatoptions
的唯一引用是 set formatoptions+=cqn
.
根据 formatoptions
上的 vim 文档:
注意:此选项设置为 Vi'compatible' 时的默认值是
设置并为 Vim 默认值,当兼容"已重置.
因此,如果 compatible 的值在此过程中不断变化,则可能会导致您看到的问题.
I've got set formatoptions=cqn
in my vimrc
, but for some reason it doesn't stick. It seems like Vim is reverting to the default (fo=tcq
) at some point… But I can't figure out why. Running -V100/tmp/log
just gives me:
formatoptions=tcq Last set from ~/.vimrc
With no useful context.
So, is there any way to make formatoptions stick? Or do I just need to create an autocmd to reset it each time a new file is loaded?
Edit
Using :verbose set formatoptions
shows this:
formatoptions=tcq Last set from ~/.vimrc
However, the only reference to fo
or formatoptions
in my ~/.vimrc is set formatoptions+=cqn
.
According to the vim documentation on formatoptions
:
NOTE: This option is set to the Vi default value when 'compatible' is
set and to the Vim default value when 'compatible' is reset.
So if the value of compatible is changing along the way, that could be causing the issue you're seeing.
这篇关于Vim:`set formatoptions` 丢失了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!