开发者

VIM cpoptions+=n in an XML file

In my vimrc I set cpoptions+=n. Usually this option stays enabled, but as soon as I open an XML file it gets disabled. I've looked through the vim folder for things that modify cpo but can't see anything interesting (other than some saving and restoring of the options so that -=C can be used, but commenting those out changes nothing).

Any idea what's causing this or some pointers as 开发者_如何学JAVAto what to look for?


Open a XML file and run :verbose set cpoptions?. This will show you the current value of the setting and what file set that value. This setting is likely being overridden by the syntax file for xml (it is in my case).

Edit: Although this normally helps, it seems in this case there are many files loaded for the XML filetype that simply save cpo off, change it for their script, then restore the original value. It doesn't look like this is going to help you much.

You may have better luck opening up an XML file and running :scriptnames, then grepping through those scripts listed for cpo to see if you can find the culprit.


If you use GVIM, set it in your .gvimrc, because this is the last loaded configuration file. See :help initialization

other way, as @Randy Morris said, a plugin might set it to the default value. In my configuration, Tabularize set it last time in .vim/bundle/after/plugin/TabularMaps.vim.

EDIT: I found it !

In autoclose plugin, in plugin/autoclose.vim the saved cpoption is not writed back at the end. Simply add

" restore cpoptions
let &cpo = s:global_cpo

to the end of the file.

If you dont use the autoclose plugin, you can search for plugin files that reset the state of cpotions by :vimgrep "set cpo&vim" ~/.vim/** then in the list you can search after the files that don't restore the original state (usually at the end of script a line starting with let &cpo = is missing).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜