Can I stop the settings in vimrc from being overwritten by plugins?

This question follows from this vim search question

I have a parameter in my .vimrc that excludes $ as the real part of the word:

set iskeyword-=$ 

This works fine for most files, but doesn't work in PHP. I assume that it is overwritten by the php plugin, but since the plugins are loaded after .vimrc, I cannot decide how to overwrite this parameter. I would rather not print

 :set isk-=$ 

every time I upload a PHP file.

Any suggestions?

(Ubuntu 8.04 / Vim 7.1.138, if that matters)

Summary

Two great answers, thanks!

I went with tomalak because it was less effort and added the following to my ~ / .vimrc

 autocmd FileType php setlocal isk-=$ 

but thanks to Luke Hermit . The settings in the ~ / vim / after / ftplugin / php.vim file also worked.

: help autocmd and: help after-directory also helped

+4
source share
3 answers

I would just add set isk-=$ to my syntax highlighting of the automatic command in $VIMRUNTIME\filetype.vim . I don't know if this is the best way to do this.

Thinking about it ... I think that would be enough to have the right auto command in your vimrc .

 au FileType php set isk-=$ 

This is done after FileType has been installed. Automatic commands are executed in the order in which they are specified, so when you put it at the end of vimrc , it will execute the latter for PHP files.

+5
source

Add {rtp} /after/ftplugin/php.vim, which contains :setlocal isk-=$

Otherwise, you will need to track where it was last changed using :verbose set isk or playback using :scriptnames

+8
source

Make a copy of your .vimrc, e.g...vimrc.ref

Make a copy in another directory.

Then find out why the plugin authors really just need to compress your .vimrc without:

  • letting you know that they are knocking him down, and
  • saving a copy of your .vimrc file so you can easily roll back.

Edit: And let http://www.vim.org/ know about those who reach your covers without letting you know!

0
source

All Articles