From cc0002ade570d88f238f7e3767c668f698520191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Mon, 22 May 2023 13:59:18 +0200 Subject: [PATCH] Add missing treesitter config --- nvim/lua/treesitter_config.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nvim/lua/treesitter_config.lua diff --git a/nvim/lua/treesitter_config.lua b/nvim/lua/treesitter_config.lua new file mode 100644 index 0000000..2612b28 --- /dev/null +++ b/nvim/lua/treesitter_config.lua @@ -0,0 +1,26 @@ +local hastreesitter, treesitter = pcall(require, "nvim-treesitter.configs") +if not hastreesitter then + return +end + +treesitter.setup({ + ensure_installed = { "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "markdown", "rust", "sql", "yaml" }, + auto_install = true, + highlight = { + enable = true, + disable = function(lang, buf) -- Disable if file size is too big + if lang == "ini" then + 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, +})