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