Build Vim from source natively on Windows 7, Windows 8.1, and
Windows 9Windows 10
Realizing my version of Vim on Windows was quite stale, I decided to build it myself from source. On Windows 8.1. How hard could it be?
Well, it’s actually pretty easy once you have the right tools. I kept running into out-of-date documentation, so I’ll try to keep this future-compatible by explaining what you need for a frustration-free experience. A complete working project is also available at https://github.com/mgiuffrida/vim.
Instructions updated 1/28/2017 for Vim 8.0 and confirmed on Windows 10.
Get the tools
You’ll also need the Windows SDKs as they don’t ship with Visual Studio anymore. The SDKs provide header files we need to compile.
First, download the Windows 7 SDK, even if you’re on Windows 8.1/10, because it has a file we need. If you’re using Windows 8.1/10, you can download the Windows 8.1 SDK as well if you like. In any case, only install the Windows SDK proper; you don’t need to install the other stuff, like the .NET SDK or the Performance Toolkit.
Get the source
Vim now lives on GitHub, so get the source with
git clone https://github.com/vim/vim.git
Configure the build
Let’s make a batch file alongside the
vim directory called
If you’re using the Windows 8.1 SDK, you’ll also need Win32.Mak, an options file for nmake. This file ships with the Windows 7 SDK, so you can simply copy it from 7.0\Include\Win32.Mak to 8.1\Include\WIn32.Mak.
Update the directories if necessary, and set your desired features. You can find more options in vim/src/Make_mvc.mak. In addition to Python, you can link with Python3 (but not both), Ruby, Perl, and more.
CPU specifies your target architecture, and
TOOLCHAIN specifies how to
- For a 32-bit version:
- For a 64-bit version:
You can build either version, but the 64-bit version will only run on a 64-bit machine. It’ll be capable of handling multi-gigabyte files, which is nice, and may run slightly faster. (On a 64-bit machine, you could also use the native amd64 toolchain if your version of VS has it, but it really doesn’t make a difference.)
If you link to a third-party library like Python, be sure you have the appropriate version (32-bit or 64-bit).
build.cmd alongside the
vim directory (or download
configure once, then invoke
build to compile vim.exe or gvim.exe,
depending on the value of
Any time you change the values in
configure.cmd and re-run
build clean before building again.
First, you need to copy the executables, docs, etc. to a directory named
vim80. (The numbers should match the output of
vim --version.) Create a
copy-vim.cmd (or download here):
copy-vim will place everything you need in vim80. You can stop here, if you’d
vim80\install.exe will run a command-line “installer”. Use the given numbers
to disable actions you don’t want—I disabled 10 (create startup file), 14
(context menu), and 17–19 (desktop icons). Enter
d to perform the actions,
and you should be all set.
If you want to install the batch files to launch Vim in the default location
(C:\windows), you’ll need to run
install.exe as an administrator. You can open
the Command Prompt from the Start menu as an administrator by holding
Ctrl+Shift, or just right-click
install.exe and choose “Run as administrator”.
You could also install to somewhere else in your
The input line is too long. The syntax of the command is incorrect.
Visual Studio is kind of silly—it will repeatedly add stuff to your PATH until
it becomes too long to work. Just close and re-open the Command Prompt and run
configure from scratch.
The specified configuration type is missing. The tools for the configuration might not be installed.
Your VS installation doesn’t include the
TOOLCHAIN you’re trying to use, so
vcvarsall.bat is unable to find the correct
E.g., Visual Studio Express may only include x86 and x86_amd64 (to cross-compile
for AMD64 using the x86-amd64 toolchain). Try setting
TOOLCHAIN to x86_amd64
if you want a 64-bit build, or x86 otherwise:
Did you close Vim before running vim-copy?
:help content missing, runtime files not loading
:help works when running Vim or gVim from the src directory (vim\src) but
not from your vim80 location, be sure the contents of vim\runtime are being
copied to vim80 via