From 2a1f3c370145c3465c0142deade3e3b2660ce829 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Wed, 15 Oct 2025 08:36:32 +0200 Subject: [PATCH] feat(treesitter): on windows, use `gcc` if available and `cl.exe` is not available for building parsers --- lua/lazyvim/plugins/treesitter.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index 5106da4e..6256904d 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -59,6 +59,16 @@ return { config = function(_, opts) local TS = require("nvim-treesitter") + -- On Windows, use `gcc` if `cl` is not available, and `gcc` is. + if + not vim.env.CC + and vim.fn.has("win32") == 1 + and vim.fn.executable("cl") == 0 + and vim.fn.executable("gcc") == 1 + then + vim.env.CC = "gcc" + end + setmetatable(require("nvim-treesitter.install"), { __newindex = function(_, k) if k == "compilers" then