-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnvim-treesitter.lua
72 lines (71 loc) · 2.49 KB
/
nvim-treesitter.lua
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
"p00f/nvim-ts-rainbow",
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
-- configure treesitter
treesitter.setup({ -- enable syntax highlighting
highlight = {
enable = true,
},
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
-- enable indentation
indent = { enable = true },
-- enable autotagging (w/ nvim-ts-autotag plugin)
autotag = { enable = true },
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"typescript",
"tsx",
"yaml",
"html",
"css",
"markdown",
"markdown_inline",
"graphql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"rust",
"toml",
"glsl",
"latex",
"cpp",
"c",
"query",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<leader>v",
node_incremental = "<leader>v",
scope_incremental = false,
node_decremental = "<bs>",
},
},
-- auto install above language parsers
auto_install = true,
})
-- Treesitter folding
-- https://neovim.io/doc/user/fold.html#fold-commands:~:text=the%20same%20time.-,2.%20Fold%20commands,-fold%2Dcommands%20E490
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
end,
}