Home

Wu Yongwei edited this page Jan 18, 2017 · 16 revisions
Clone this wiki locally

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 shows that there are some display refreshing problems with Vim on Windows, which do not occur when DirectX rendering is enabled. My current set-up is around Visual Studio 2012 (I have tested that it works with Visual Studio 2013 as well). 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, Python 2, and Tcl

I use Perl 5.24, Python 2.7, and Tcl 8.6. All of them are 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
  • ActiveTcl8.6.4.1.299124-win32-ix86-threaded.exe

Python 3

The Official Python 3.5.2 for Windows is used:

  • python-3.5.2.exe

Lua

I use the official Win32 build of Lua 5.1.4:

  • LuaForWindows_v5.1.4-46.exe

Ruby

I use the official Win32 build of Ruby 2.2.5:

  • rubyinstaller-2.2.5.exe

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

mkdir /cygdrive/c/Ruby22/include/ruby-2.2.0/i386-mswin32_110
cp -p external/Ruby200/include/ruby-2.0.0/i386-mswin32_110/ruby/config.h \
   /cygdrive/c/Ruby22/include/ruby-2.2.0/i386-mswin32_110/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 VS2012, 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