When doing Windows development, I usually use Vim under Cygwin. I use my little Cygwin hack to make it portable. This allows me to easily copy my Cygwin installation along with all my settings to multiple computer.
I rely heavily on Fugitive which is a great Vim plugin for Git. Unfortunately, it runs extremely slowly on my main work computer. So, on that computer, I use gVim Portable from the PortableApps platform. It works great. The tricky part is making it work along with Git (for Fugitive) and Python (for UltiSnips). It involves installing Git along with the proper version of Python and tweaking a configuration file of gVim Portable.
Installing Portable Git
Download it from their website. Make sure to download the portable version.
Then, install it alongside of gVim.
e:
├── gVimPortable
│ ├── App
│ ├── ...
│ ├── gVimPortable.exe
│ └── ...
└── PortableGit
├── bin
├── ...
├── git-bash.exe
├── git-cmd.exe
└── ...
Installing Python
It is important to install the appropriate version of Python. It needs to be a Python 3 version because UltiSnips does not support Python 2 anymore. Furthermore, it needs to be the Python version expected by Vim. See my previous article on installing Ultisnips on Cygwin for a description of the technique to use to find out which Python version your installation of Vim expects to find on your system.
As of this writing, gVim Portable needs Python 3.6. Furthermore, gVim Portable was compiled for 32-bit systems.
So the portable x86 version should be used.
As for Git, install it alongside gVim.
e:
├── gVimPortable
│ ├── ...
│ ├── gVimPortable.exe
│ └── ...
├── PortableGit
│ ├── ...
│ ├── git-bash.exe
│ ├── git-cmd.exe
│ └── ...
└── Python36-x86
├── ...
├── python.exe
├── ...
├── python36.dll
└── ...
Configuring gVim Portable
We must now tell gVim where to find our intallations of Git and Python. For that, we must edit the gVimPortable.ini file located deep into the directory structure.
e:
└── gVimPortable
└── App
└── AppData
└── Launcher
└── gVimPortable.ini
Add the PYTHON_HOME
and GIT_HOME
variable definitions to the
[Environment]
section of the file.
[Environment]
VIM=%PAL:AppDir%\vim
VIMRUNTIME=%PAL:AppDir%\vim\vim80
HOME=%PAL:DataDir%\settings
LANG=%PAL:LanguageCustom%
PYTHON_HOME=%PAL:PortableAppsDir%\Python36-x86
GIT_HOME=%PAL:PortableAppsDir%\PortableGit
Finally, modify the PATH
variable in your .vimrc file to add the
path to your Git and Python installation.
if !empty($PYTHON_HOME)
let $PATH .= ';' . $PYTHON_HOME . ';' . $PYTHON_HOME . '\scripts'
let $PYTHONHOME = $PYTHON_HOME
endif
if !empty($GIT_HOME)
let $PATH .= ';' . $GIT_HOME . '\bin'
endif
After this, Fugitive and Ultisnips should work fine when editing files in your gvim installation.