Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get gVim (Windows) to use "home\.vim" for my plugins?

I have a Desktop running Windows 7, and a Macbook Pro running Mountain Lion. I use gVim and MacVim respectively. I like to keep my plugins and settings synced between the machine, so I store them in my Google Drive, and I can always pull them from there.

On my Mac, I just have a .gvimrc file and a .vim folder in my home folder, and Vim loads all my plugins and settings properly.

On my Windows computer however, Vim WILL properly load settings from the .ggvimrc file in my home folder. But if I store plugins in "home.vim\plugin" Vim will NOT load them.

To get plugins/themes working on my Windows machine, I need to put them in "C:\Program Files (x86)\Vim\vimfiles\plugin"

I would like to be able to store everything in my "home.vim" folder on either machine, and have it work properly.

So is there any way to set this up on my Windows machine?

Thank you!

like image 949
Austin R Avatar asked Nov 30 '12 18:11

Austin R


People also ask

Where is home vim?

vim Configuring Vim Files and directories on Linux, BSD and Cygwin, $HOME is usually /home/username/ , on Mac OS X, $HOME is /Users/username/ , on Windows, $HOME is usually C:\Users\username\ .

Where is. vim folder Windows?

On Windows 10, the vim directory is located at %USERPROFILE\vimfiles , you may link it to any other directory through the mklink command.


1 Answers

As long as you keep your .vimrc in a default location (cp. :help vimrc), and only want to change the path to plugins, syntax files, etc., you can put the following into your .vimrc file:

if has('win32') || has('win64')
    set runtimepath=path/to/home.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,path/to/home.vim/after
endif

You didn't specify your exact path, so I used path/to/home.vim here; adapt to your system.


Your use case of synchronizing the configuration is quite common, what is unusual is that you seem to want to keep your .[g]vimrc in a default location, but only move the plugins etc. somewhere else. Typically, both .vimrc and the .vim/plugins subfolders are moved away, and people use symbolic links (created with mklink on Windows) to refer to them from their home directory.

like image 135
Ingo Karkat Avatar answered Oct 26 '22 10:10

Ingo Karkat