Compiling Vim and GVim 64bit on Windows 7

This post was prompted by trying to compile Vim as a 64 bit executable on Windows7 using only freely available tools. To be honest it has been a total pain in the arse and taken a lot of experimentation so i’d though i’d share how i eventually did it.

Get the Vim source code

The source code for Vim is freely available from the website however it’s best to download it using Mercurial that way you get all the latest patches. Mercurial is a source code manager which you will need to install first from Once Mercurial is installed, open a Windows command prompt and CD to a directory where you would like to place the Vim source and issue the following command.

This will download the latest Vim sources from the online Mercurial repository.

Install the necessary tools

The following tools are needed for successfully compiling a 64 bit executable. The SDK contains scripts to setup a correct environment and the earlier versions of Visual Studio Express didn’t contain tools to compile a 64bit executable (which incidentally was a great deal of fun investigating, …not). So the new Visual Studio 2012 Express for Windows Desktop version will need installing. Click the links below to download the installers.

  1. Visual Studio 2012 Express for Windows Desktop
  2. Microsoft Windows SDK for Windows 7 and .NET Framework 4

Hack The Make Files

Yes this is the ugly part, we need to alter the make files that come with the Vim source to support the new Visual Studio 2012 Express version. Not only that but introduce a path variable so a particular file in the SDK can be found. This path variable is probably not needed if the environment was set up correctly but i couldn’t find a script to do that so this simple hack works.

Open this file  vim\src\GvimExt\Makefile  which is inside the Vim source code and change it according to this diff. (The minuses are lines removed and the pluses are lines added.) Here we are just adding the SDK path as a variable.

Once that is done open the file located at  vim\src\Make_mvc.mak  and make the following changes. Here we are adding the SDK path again and adding support for the new version of Visual Studio Express.

Create a compile batch file

Once all the above make files have been altered create a file called  compile.bat  and place in the  vim\src\  directory. Edit that file and add the following to it. 1

Once this has been saved, open a command prompt (if you haven’t got one open) CD to the vim\src\  directory within the Vim source code and issue the following command to execute the compile batch file.

This will setup the compiler environment for 64 bit, set up optional environment variables to control Vim’s compilation and then kick off the compilation process.

If the batch file is left as above it will (or should) compile a 64 bit GVim executable. To create a Vim executable you simply alter the  SET GUI=yes  line to  SET GUI=no  and compile again. A full list of compiler options for the batch file can be found here.


If you don’t want to do the above or it’s not working, here’s a download link which includes the above hacked make files and compiled executables (compiled with python3 support).

Vim 7.3.661 64bit for Windows (with Python3 support)

Show 1 footnote

  1. Make sure the SDK_INCLUDE_DIR variable points to the SDK include folder and make sure the VC_DIR variable points to the VC directory within the Visual Studio Express install folder. These may be different if you installed the tools in a different location other than the default.
Submit a comment


  1. Hi, I found your post extremely useful. I’m working on installing vim7.4, and this has made the process a lot easier. I have a question for you. The page you link to doesn’t list an option called “CPU” for the batch file, only CPUNR. You have “SET CPU=amd64″ in your compile.bat file. I would be much obliged if you could tell me if this is because of something I missed or if it is because of changes to the vim build options. Thanks!

Leave a Reply to Bharathan Rajaram Cancel reply

We would love to hear your thoughts. Feel free to submit a comment and join the conversation!

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">