dotfiles/nvim/lua/treesitter_config.lua

27 lines
910 B
Lua
Raw Normal View History

2023-05-22 13:59:18 +02:00
local hastreesitter, treesitter = pcall(require, "nvim-treesitter.configs")
if not hastreesitter then
return
end
treesitter.setup({
2023-10-10 20:02:50 +02:00
ensure_installed = { "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml" },
2023-05-22 13:59:18 +02:00
auto_install = true,
highlight = {
enable = true,
disable = function(lang, buf) -- Disable if file size is too big
2023-10-10 20:02:50 +02:00
if lang == "ini" or lang == "markdown" then
2023-05-22 13:59:18 +02:00
return true
end
local max_filesize = 2000 * 1024 -- 2MB
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,
},
indent = {
enable = true
},
additional_vim_regex_highlighting = false,
})