generated from AstroNvim/user_example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreesitter.lua
74 lines (73 loc) · 3.32 KB
/
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
73
74
return {
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = { "css", "html", "typescript", "svelte" },
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
highlight = {
enable = true,
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
},
incremental_selection = { enable = true },
indent = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["ak"] = { query = "@block.outer", desc = "around block" },
["ik"] = { query = "@block.inner", desc = "inside block" },
["ac"] = { query = "@class.outer", desc = "around class" },
["ic"] = { query = "@class.inner", desc = "inside class" },
["a?"] = { query = "@conditional.outer", desc = "around conditional" },
["i?"] = { query = "@conditional.inner", desc = "inside conditional" },
["af"] = { query = "@function.outer", desc = "around function " },
["if"] = { query = "@function.inner", desc = "inside function " },
["al"] = { query = "@loop.outer", desc = "around loop" },
["il"] = { query = "@loop.inner", desc = "inside loop" },
["aa"] = { query = "@parameter.outer", desc = "around argument" },
["ia"] = { query = "@parameter.inner", desc = "inside argument" },
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]k"] = { query = "@block.outer", desc = "Next block start" },
["]f"] = { query = "@function.outer", desc = "Next function start" },
["]a"] = { query = "@parameter.inner", desc = "Next argument start" },
},
goto_next_end = {
["]K"] = { query = "@block.outer", desc = "Next block end" },
["]F"] = { query = "@function.outer", desc = "Next function end" },
["]A"] = { query = "@parameter.inner", desc = "Next argument end" },
},
goto_previous_start = {
["[k"] = { query = "@block.outer", desc = "Previous block start" },
["[f"] = { query = "@function.outer", desc = "Previous function start" },
["[a"] = { query = "@parameter.inner", desc = "Previous argument start" },
},
goto_previous_end = {
["[K"] = { query = "@block.outer", desc = "Previous block end" },
["[F"] = { query = "@function.outer", desc = "Previous function end" },
["[A"] = { query = "@parameter.inner", desc = "Previous argument end" },
},
},
swap = {
enable = true,
swap_next = {
[">K"] = { query = "@block.outer", desc = "Swap next block" },
[">F"] = { query = "@function.outer", desc = "Swap next function" },
[">A"] = { query = "@parameter.inner", desc = "Swap next argument" },
},
swap_previous = {
["<K"] = { query = "@block.outer", desc = "Swap previous block" },
["<F"] = { query = "@function.outer", desc = "Swap previous function" },
["<A"] = { query = "@parameter.inner", desc = "Swap previous argument" },
},
},
},
},
},
}