Wednesday, October 26, 2011

Re: question about vim scripts.

Ben Fritz wrote:
>
> On Oct 26, 6:44 am, gaoqiang<gaoqiangs...@gmail.com> wrote:
>
>> running command "scriptnames" ,I got the following output.
>> $HOME/.vimrc is read first. which means,my own settings may be covered
>> by other vim-script. and that is not what I want. anyone can help?
>> just make the $HOME/.vimrc read last.
>>
> I don't think you really want this. The .vimrc is sourced first by
> design. It allows filetype-specific settings to apply over the top of
> global settings from the .vimrc, among other things (e.g. preventing
> plugins from loading by setting a variable in your .vimrc).
>
> You probably want to use an autocmd in your .vimrc, or a file in an
> appropriate "after directory" to correct any settings you don't like
> from plugins.
>
> Anything in a VimEnter autocmd, or anything in a script anywhere in
> $HOME/.vim/after/plugin, will be sourced automatically after all the
> plugins load.
>
> Anything in a "Filetype c" autocmd, or anything in $HOME/.vim/after/
> ftplugin/c.vim, will be sourced automatically after filetype-specific
> stuff for C code.
>
> These are examples. Do you have a specific problem?
>
>
Usually plugins only change a few things when first sourced, and those
are usually restored at the end of the plugin. A typical example is cpo
(otherwise, a plugin that uses continuation may throw errors when the
user normally doesn't permit continuation). More persistent changes in
settings usually occur when the plugin is actually used. Consequently,
having $HOME/.vimrc read last, aside from being IMHO a bad idea and
breaking nearly everyone's setup if made standard, would also have
little effect on the issue you mention.

Regards,
Chip Campbell

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: