On Fri, 13 May 2011, Ben Schmidt wrote:
On 13/05/11 5:02 AM, Benjamin R. Haskell wrote:
Since that gets run before my ~/.vimrc, my runtimepath hasn't yet
been setup. As far as I can tell, there's no way to disable
/etc/vimrc (SYS_VIMRC_FILE) from within .vimrc, because of the order
in which they're sourced. Is that accurate?
Yes.
Argh.
In Zsh, I always disable the global startup files from within my own
startup files to avoid these same kinds of cross-distribution
differences. If it's not possible, I'll switch to explicitly using
`vim -u ~/.vimrc` (via an alias). Anything to watch out for in that
case? (Trying it on the affected system throws a few warnings, due to
different plugin load order, but that's somewhat expected.)
One thing to look out for is the setting of 'compatible'; I don't
think -u will reset it, so you will need to do so at the beginning of
your .vimrc to get the same results as usual, or use -N to get similar
results. See :help compatible-default.
Yep. Figured that out shortly after sending. (Wasn't plugin load order
that was causing trouble -- was the lack of nocp.)
I really prefer the in-.vimrc method, because the "don't run global
rc" option is self-contained. (So that it works even in cases where
aliases aren't active, for example, and configuring Vim the way I
want it only involves rsync'ing my ~/.vim directory.)
You could possibly avoid a system vimrc through your environment by
setting $VIM to somewhere that Vim will not find the system vimrc, and
$VIMRUNTIME to somewhere it will find its (hopefully unaltered)
runtime files. See :help $VIM and :version. I don't think Vim uses
$VIM for much other than setting $VIMRUNTIME and finding system vimrc
and gvimrc, so if you set $VIMRUNTIME explicitly yourself, too, you
may well be in business. Perhaps not as good as being in-.vimrc, but
at least under your control as you can do it in your shell startup
files, not rely on varying sysadmins' and distros' decisions.
Unfortunately, $VIM is only used for the user rc. $VIM =
/usr/share/vim, but global vimrc = /etc/vimrc, despite whatever I tried
to override VIM/VIMRUNTIME with.
Going with the alias v='vim -u ~/.vimrc -N' solution. Not too horrible,
I guess.
--
Best,
Ben H
--
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