如何找出 Vim 设置在哪个插件中被更改? [英] How to find out, in which plugin a Vim setting gets changed?

查看:30
本文介绍了如何找出 Vim 设置在哪个插件中被更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我有一些不为人知的行为.我有

设置自动缩进

在我的 vimrc 中,但由于某种原因,每当我打开一个 PHP 文件时,它都会被关闭.

我现在通过添加像

这样的行来修复它

autocmd FileType php set autoindent

但我仍在尝试找出禁用此设置的位置.那么有什么方法可以找出 vim 配置中的某个设置被更改的位置?

这里是我在 Ubuntu 上使用的完整 vimrc.local 供参考:

https://gist.github.com/mikehaertl/1612035/5fa1006577d193857

问题是由 filetype indent on 引起的,我前段时间添加到我的配置中.不知道,为什么这会影响自动缩进.

:verbose 命令将告诉您选项最后更改的位置:

:verbose 设置自动缩进?

如果单独这样做没有帮助,您可以检查所有已执行的命令,最好将输出重定向到日志文件中:

:set verbosefile=vim.log:20verbose 编辑 foo.php

另请注意,有几个控制缩进的选项,例如'cindent''smartindent''indentexpr'

PS:为避免修改后的选项值溢出到其他缓冲区,建议改用:setlocal.

Today I had some obscure behavior. I have

set autoindent

in my vimrc, but for some reason, this gets turned off, whenever i open a PHP file.

I've fixed it now by adding a line like

autocmd FileType php set autoindent

But I'm still trying to figure out, where this setting is disabled. So is there some way to find out, where in the vim config a setting gets changed?

For reference here's my full vimrc.local that I'm using on Ubuntu:

https://gist.github.com/mikehaertl/1612035/5fa149468006577d193858bbc8cefcd3a413e017

EDIT: The problem was caused by a filetype indent on that I added some time ago to my config. No idea, why that affects autoindent, though.

解决方案

The :verbose command will tell you where an option was last changed:

:verbose set autoindent?

If that alone doesn't help, you can inspect all executed commands, preferably with the output redirected into a logfile:

:set verbosefile=vim.log
:20verbose edit foo.php

Also note that there are several options controlling indentation, e.g. 'cindent', 'smartindent', 'indentexpr', etc.

PS: To avoid that the changed option value spills into other buffers, it's recommended to use :setlocal instead.

这篇关于如何找出 Vim 设置在哪个插件中被更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆