Vundle for Windows

Charly Mourglia edited this page Dec 24, 2016 · 40 revisions

Requirements

  1. Git
  2. Curl

Git on Windows

Thanks to msysgit installation is trivial:

  1. Download msysgit installer
  2. run downloaded installer and follow instructions It's important to configure PATH environment variable properly. That's why it's recommended to select Run git from Windows command prompt option, as shown: add git to PATH

After installation try running git --version within command prompt (press Win-R, type cmd, press Enter) to make sure all good:

C:\> git --version
git version 1.7.4.msysgit.0

Curl on Windows

Installing Curl on Windows is easy as Curl is bundled with msysgit! But before it can be used with Vundle it's required make curl run in command prompt. The easiest way is to create curl.cmd with this content

@rem Do not use "echo off" to not affect any child calls.
@setlocal

@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\mingw64\bin;%PATH%
@rem !!!!!!! For 64bit msysgit, replace 'mingw' above with 'mingw64' !!!!!!!

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@curl.exe %*

And copy it to C:\Program Files\Git\cmd\curl.cmd, assuming msysgit was installed to c:\Program Files\Git

to verify all good, run:

C:\> curl --version
curl 7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k zlib/1.2.3
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: Largefile NTLM SSL SSPI libz

Vundle on Windows

Different File Names

By default, Vim on Windows will still look for .vimrc and install to ~/.vim. Since this isn't standard on Windows (you would have to enable hidden files) an alternative is to use _ files. That means instead of having a .vimrc file it will be a _vimrc in your home. Instead of .vim, we usually use a folder called vimfiles.

Additionally, if you've set %HOME% environmental variable to some directory, that's the directory vim will search as ~/, thus you have to put _vimrc file and vimfiles folder under the directory or remove %HOME% from environmental variable settings to use %USERPROFILE% as default.

To make these changes, open the cmd prompt or msysgit bash and execute the following lines. If you do not have gvim on your path, use vim instead.

cd %USERPROFILE%
git clone https://github.com/VundleVim/Vundle.vim.git %USERPROFILE%/vimfiles/bundle/Vundle.vim
gvim _vimrc

From here, go to step 3 in the quick start and copy the sample config of Vundle into the _vimrc file.

Go to line around 11 and change

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

to

set rtp+=$HOME/vimfiles/bundle/Vundle.vim/
call vundle#begin('$USERPROFILE/vimfiles/bundle/')

If you run into any problems, see the FAQ.

Trailing slash issue

Sometimes Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} may not work for you. Note the vim/ part. The trailing slash causes Vim on windows to not load the plugin and may affect others. The fix is simple; change it to:

Bundle 'rstacruz/sparkup', {'rtp': 'vim'} 

See #193 for more details.

E484: Can't open file C:\Users\<userid>\AppData\Local\Temp\... Error

Under certain situations a Virus Checker or a Windows itself may prevent file creation in the Windows Temp folder located under the %USERPROFILE% folder. One possible solution might be to change the location of your %TEMP% and %TMP% variables to point elsewhere (perhaps C:\temp). To do this launch Control Panel -> System -> Advanced system settings -> Environment Variables and I change your TMP and TEMP variables from %USERPROFILE%\AppData\Local\Temp to C:\temp relaunched vim and then try your Vundle command that was previously failing with the E484 error.

For other solutions see Issue 575