Skip to content
Wu Yongwei edited this page Jan 23, 2024 · 24 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 2022 (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.

Vim currently requires Visual Studio 2015 or later, and I am using Visual Studio 2022 to build Vim.

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

I use Perl 5.32 from Strawberry Perl. The exact version numbers I use can be seen from the file name:

  • strawberry-perl-5.32.1.1-32bit.msi

Python 2

I use Python 2.7 from ActiveState. The exact version numbers I use can be seen from the file name:

  • ActivePython-2.7.10.12-win32-x86.msi

Python 3

The Official Python 3.10.5 for Windows is used:

  • python-3.10.5.exe

Ruby

I use RubyInstaller 3.2.2-1:

  • rubyinstaller-3.2.2-1-x86.exe

However, it does not work with Microsoft Visual C++ out of the box. The build experience is so hacky that it is not even worth recording. I absolutely cannot guarantee its build quality.

Libsodium

libsodium-1.0.18-msvc.zip is extracted to C:\Libraries.

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.

After the requirement of Visual Studio 2015 or later, I have not found a working XPM binary yet. I guess it does not really matter....

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/vim91/'
runtime/update_vimruntime.sh