-- ~/.config/nvim/lua/config/treesitter.lua return function() require'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "cpp", "rust", "haskell", "python" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, -- Automatically install missing parsers when entering buffer auto_install = true, -- List of parsers to ignore installing -- ignore_install = { "javascript" }, highlight = { enable = true, -- disable = { "c", "rust" }, -- parsers to disable -- Disable for large files -- disable = function(lang, buf) -- local max_filesize = 100 * 1024 -- 100 KB -- 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, -- Run 'syntax' and tree-sitter at the same time -- additional_vim_regex_highlighting = false, }, -- incremental_selection = { -- enable = true, -- keymaps = { -- init_selection = "gnn", -- node_incremental = "grn", -- scope_incremental = "grc", -- node_decremental = "grm", -- }, -- }, textobjects = { enable = true, keymaps = { ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", }, }, fold = { enable = true, }, } end