1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
|