fix nvim: nvim-treesitter

This commit is contained in:
Yuan Chiu 2025-05-05 21:52:19 +08:00
parent 6b42c103ea
commit bba73ba72c

View File

@ -1,14 +1,24 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
cond = function()
-- 檢查是否有 gcc 或 clang 或 cc任一存在就啟用
return vim.fn.executable("gcc") == 1
or vim.fn.executable("cc") == 1
or vim.fn.executable("clang") == 1
or vim.fn.executable("cl") == 1
or vim.fn.executable("zig") == 1
end,
build = ":TSUpdate", build = ":TSUpdate",
config = function() config = function()
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
ensure_installed = { "regex" }, -- 確保安裝 regex 支援 ensure_installed = { "lua", "php", "python", "go", "html", "css", "javascript" },
-- ensure_installed = { "regex" }, -- 確保安裝 regex 支援
highlight = { highlight = {
enable = true, -- 啟用高亮 enable = true, -- 啟用高亮
}, },
indent = { enable = true },
}) })
end, end,
} },
} }