It was a real hassle to get nvim-treesitter to work on Windows 11. Here is how I got it working. - A working installation guide in 2024.
Dependencies
The neovim treesitter plugin requires a working C/C++ compiler to install new language support. Even though the github documentation explains how to install several C/C++ compilers, only one worked for me: clang
compiler installed through the Build Tools for Visual Studio 2022. Installing clang from the LLVM app did not link properly and using the cl
compiler from the Build Tools did not work either.
First, download the Build Tools for Visual Studio
In the installation windows, be sure to check Desktop development with C++ on the left and C++ clang tools for Windows on the right as show in the picture below.
Then, update the system environment variables and set CC = clang
.
Setup steps
To avoid parsers conflicts, rename the following folder:
|
|
To something else, for instance:
|
|
Configure the terminal
To be able to compile the treesiter parsers, you need a working developper terminal. Here is how to configure powershell.
First, open or create the powershell user-profile file:
|
|
And paste this code (related stackoverflow thread) inside:
|
|
Finally, restart your terminal and make sure you are running 64 bit powershell as follows:
|
|
This should respond true
. If it doesn’t look for the 64bit powershell executable on your machine.
Install nvim-treesitter
Finally, install nvim-treesitter using you favorite package manager. The nvim-treesitter github has some installation instructions. Here is my init.lua
file:
|
|
Hopefully, you can get it up and running too. Happy coding!