Skip to content

Instantly share code, notes, and snippets.

@farisachugthai
Created July 24, 2020 03:27
Show Gist options
  • Save farisachugthai/00491bf07f237a15996f6ba12e0ac365 to your computer and use it in GitHub Desktop.
Save farisachugthai/00491bf07f237a15996f6ba12e0ac365 to your computer and use it in GitHub Desktop.

Building Neovim on Windows

Note: Requires Visual Studio

Most of the existing guides I've seen either assume msys2, which I didn't intend on downloading or don't give a particularly useful amount of direction to someone who's not well versed with Visual Studio.

As a recent Windows adopter (hence my use of neovim), I wanted to lay out how to best build neovim.

1) Installing Visual Studio.

I installed Visual Studio 2019 Community with a plethora of useful Cpp tools. It's quite a load on your hard drive so ensure you have at least 10 gb free if you have nothing installed.

As a minimum, ensure that the Desktop C++ tools and cmake with ninja are installed.

2) Correctly configure Visual Studio.

There are a handful of other configurations that are available, but for the time being I've only built it with x64 Debug and x64 Release. I'm interested in the clang builds and possibly even the WSL builds as they exist; however, a cursory attempt at running these immediately crashed.

3) Generate the cmake cache.

This should run automatically without a CMakesettings.json file.

After this completes successfully, run the build. Note that if it doesn't complete successfully, I genuinely had success by closing Visual Studio, reloading it and trying again.

When in doubt, turn it off and turn it back on again I guess.

Generating cmake's cache generated a few hundred warnings for me, but no errors so note that that could happen.

For the curious

Build Neovim on Windows using Visual Studio. MSBuild and building the repository won't be as simple as a classic

configure; make; make install

1> Command line: "cmd.exe" /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Casey\Source\Repos\neovim\out\install\x64-Release" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/HostX64/x64/cl.exe" -v -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\Casey\Source\Repos\neovim" 2>&1"

4) Ctrl+Shift+B

Runs the build.

5) Install

Under the Build drop-down menu, you'll observe that underneath Build Directory will be an option to Install nvim.

After running this, I was able to run the executable in ./out/install/x64-release/bin/nvim-qt.exe

While that path is a mouthful, especially if you defaulted to putting nvim in $HOME/source/repos/neovim, I simply added the icon to the start menu which I admittedly forget is an option in comparison to simply expecting binaries to show up in /usr/local/bin.

To be continued: Other observations for packages that seemed to be required not mentioned here, or other tips to get things working.

My device additionally has all of.:

  • scoop
  • choco
  • git for windows
  • clang
  • clang-cl
  • python3
  • WSL

and many other things installed; so I can't deny that none of these being present and on the standard user $PATH didn't contribute to the general ease with which I built the standard configurations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment