Wu Yongwei edited this page May 26, 2018 · 18 revisions

Build Vim for Win32

The purpose of this project is to build the latest version of Vim for Win32 quickly. I used to download the source code and then download and apply patches. With the Vim source code moving to GitHub, it really feels like a breeze.

I used to build Vim with Visual Studio 2003 .NET. However, the directx feature of Vim requires a newer Visual C++ compiler. Without it, Unicode characters beyond the Basic Multilingual Plane (BMP) cannot be displayed. My experience also showed that some display refreshing problems might occur with Vim on Windows in some circumstances, which were eliminated when DirectX rendering was enabled. My current set-up is around Visual Studio 2013 (I started with Visual Studio 2012, and I see no reason why it would not still work). If another Visual C++ compiler is used, you may need to adjust build.bat.

Set up the Source Repository

Of course, you need Git in the beginning. I use the Cygwin version. After Cygwin and Git are installed, one can follow the standard GitHub procedure and type the following line in Cygwin Terminal:

git clone https://github.com/adah1972/vim.git

Set up the Build Environment

Of course, first you need the compiler, Visual Studio. There are other dependencies as well, and I will describe in this section.

Perl and Python 2 (no Tcl)

I use Perl 5.24 and Python 2.7, both downloaded from ActiveState. The exact version numbers I use can be seen from the file names:

  • ActivePerl-5.24.0.2400-MSWin32-x86-64int-300560.exe
  • ActivePython-2.7.10.12-win32-x86.msi

I used to compile with Tcl support too. However, ActiveTcl 8.6.6 seems to conflict with my build environment (it would cause a compilation error), and ActiveTcl 8.6.4 no longer works with Vim 8.1. I personally do not use Tcl, so I did not try harder.

Python 3

The Official Python 3.6.5 for Windows is used:

  • python-3.6.5.exe

Ruby

I use RubyInstaller 2.4.4-1:

  • rubyinstaller-2.4.4-1-x86.exe

However, it does not work with Microsoft Visual C++ out of the box. One has to create a config.h for use with Visual C++. Assuming the standard installation path and Visual Studio 2013, this is what one needs (from Cygwin Bash in the Vim root):

mkdir /cygdrive/c/Ruby24/include/ruby-2.4.0/i386-mswin32_120
cp -p external/Ruby200/include/ruby-2.0.0/i386-mswin32_120/ruby/config.h \
   /cygdrive/c/Ruby24/include/ruby-2.4.0/i386-mswin32_120/ruby/

XPM

The XPM version I use is under the "external" directory of Vim root. My build.bat assumes xpm.zip is extracted to C:\Libraries.

Synchronize and Build

I can now update Vim (from Cygwin Terminal) with

./sync_vim.sh

When building Vim, I launch Developer Command Prompt for VS2013, go to the "src" directory under the Vim root, and then type

build.bat

Update Locally Installed Vim

With the previous steps, you already know how to retrieve the latest source code of Vim and build it on Windows. The built executables and the updated run-time files are not in your Vim installation yet. Assuming GVIM for Windows is installed to the default path on 64-bit Windows ("C:\Program Files (x86)\Vim"), you need to launch a Cygwin Terminal with Administrator rights, go into the Vim directory, and type:

cp -p src/*vim.exe 'C:/Program Files (x86)/Vim/vim80/'
runtime/update_vimruntime.sh
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.