I have a line
set cpoptions+=$
in my .vimrc file. However according to
verbose set cpoptions output:
cpoptions=aABceFs
Last set from /usr/share/vim/vim73/plugin/zipPlugin.vim
: it is always overridden by zipPlugin.vim. I am wondering why is vim reading these plugins after reading my .vimrc file? Any way to fix this?
Because vim always reads vimrc before the plugins. This load sequence makes sense because in this case you can set plugin options in the vimrc. It can’t be overriden, but you can source zipPlugin (with
:source /usr/share/vim/vim73/plugin/zipPlugin.vimor:runtime plugin/zipPlugin.vim) from the vimrc. AFAIK it won’t prevent plugin from loading for the second time but as this plugin is using guard it won’t continue to the cpo resetting line when being sourced for the second time.Note that if yourzipPlugin.vimis identical to mine, then it is not the source of the problem: if you look at its code you will see that it is saving yourcpoptionssetting and then restoring it. As other plugins distributed with vim must do the same or do not touchcpoptionsat all then you can forget the above recommendation. I would suggest to first look that lineset nocompatible(orset nocp), if any, is the first line present in the vimrc. Remember that setting this option causes many other options to reset to their defaults (includingcpoptions) and it is why it must go before any other line modifying options.Update: Now I see that you have provided a link to the vimrc and it does not have the above problem. Try to check
verbose set compatible?, then try to launch vim with the following command:You will have some false positives here: first loaded vimrc (
/etc/vim/vimrc): becausecpowas not set, any plugins loaded like: here cpo is reset before plugins are loaded, but at the end there goes
thus it is really safe. On my system there are only false positives: though cpo is saved and restored by many plugins, no plugins forget to restore it or do something else.