Pregunta

I'm trying to install spf13-vim (a bunch of plugins) on Windows for using gVim, and I'm having trouble since the plugins (vimfiles) separately from my $HOME. Because of this, I've installed the plugins to another directory (C:\Users\myuser) where all the vimfiles are located.

Since Vim looks in my $HOME (H:\, a network drive) for the _vimrc, I've tried to add a _vimrc file there containing the following:

set runtimepath+=C:\Users\myuser\.vim

Starting Vim and running :set runtimepath? returns the following:

runtimepath=H:\vimfiles,<standard vim directories>,C:\Users\myuser\.vim

The runtimepath seems to be correct, but gVim doesn't start any plugins as it should according to the _vimrc located in C:\Users\myuser.

Obviously, _vimrc isn't loaded. I can't seem to find why though, since the runtimepath includes the directory. I might have misunderstood how Vim loads the information, but can't find the error.

How can I get gVim to load the correct _vimrc in C:\Users\myuser\ at start up?

¿Fue útil?

Solución

Obviously, _vimrc isn't loaded.

To be clear, you have two files of that name: one in your home directory, which is being loaded, and one in C:\Users\myuser\, which is not being loaded.

Vim does not load every file named _vimrc found in a 'runtimepath' directory: it only searches a few directories, and then only loads the first one it finds. (Maybe two, if one of them is a system vimrc file.)

If you want to source the second _vimrc, then add the line

source C:\Users\myuser\_vimrc

to the _vimrc in your home directory. (Untested, since I do not have a Windows computer handy.)

If you want all the plugins to be loaded, then put the plugin files under C:\Users\myuser\.vim\plugin\. You could do the same with the second _vimrc.

:help startup
:help _vimrc
:help :source
:help plugin
:help load-plugins
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top