diff options
Diffstat (limited to 'lua/config/treesitter.lua')
| -rw-r--r-- | lua/config/treesitter.lua | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua new file mode 100644 index 0000000..d852bee --- /dev/null +++ b/lua/config/treesitter.lua @@ -0,0 +1,56 @@ +-- ~/.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 + |
