snowflake/config/nvim/lua/plugins/treesitter.lua
2025-05-30 22:59:38 +08:00

39 lines
898 B
Lua

---@diagnostic disable: missing-fields
return {
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup {
ensure_installed = {
'lua',
'python',
'c',
'javascript',
'typescript',
'astro',
},
auto_install = false,
-- ignore_install = {},
highlight = {
enable = true,
---@diagnostic disable-next-line: unused-local
disable = function(lang, buf)
local max_filesize = 100 * 1024
---@diagnostic disable-next-line: undefined-field
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
disable = { 'python', 'c' },
},
}
end,
},
}