-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnvim-treesitter-textobjects.lua
104 lines (104 loc) · 3.05 KB
/
nvim-treesitter-textobjects.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup({
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['am'] = '@function.outer',
['im'] = '@function.inner',
['ao'] = '@loop.outer',
['io'] = '@loop.inner',
['ak'] = '@class.outer',
['ik'] = '@class.inner',
['a,'] = '@parameter.outer',
['i,'] = '@parameter.inner',
['a/'] = '@comment.outer',
['a*'] = '@comment.outer',
['ag'] = '@block.outer',
['ig'] = '@block.inner',
['a?'] = '@conditional.outer',
['i?'] = '@conditional.inner',
['a='] = '@assignment.outer',
['i='] = '@assignment.inner',
['a#'] = '@header.outer',
['i#'] = '@header.inner',
['a3'] = '@header.outer',
['i3'] = '@header.inner',
},
selection_modes = {
['@block.outer'] = 'V',
['@block.inner'] = 'V',
['@header.outer'] = 'V',
['@header.inner'] = 'V',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']o'] = '@loop.outer',
[']]'] = '@function.outer',
[']k'] = '@class.outer',
['],'] = '@parameter.outer',
[']g'] = '@block.outer',
[']?'] = '@conditional.outer',
[']='] = '@assignment.inner',
[']#'] = '@header.outer',
[']3'] = '@header.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']O'] = '@loop.outer',
[']['] = '@function.outer',
[']K'] = '@class.outer',
[']<'] = '@parameter.outer',
[']/'] = '@comment.outer',
[']*'] = '@comment.outer',
[']G'] = '@block.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[o'] = '@loop.outer',
['[['] = '@function.outer',
['[k'] = '@class.outer',
['[,'] = '@parameter.outer',
['[/'] = '@comment.outer',
['[*'] = '@comment.outer',
['[g'] = '@block.outer',
['[?'] = '@conditional.outer',
['[='] = '@assignment.inner',
['[#'] = '@header.outer',
['[3'] = '@header.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[O'] = '@loop.outer',
['[]'] = '@function.outer',
['[K'] = '@class.outer',
['[<'] = '@parameter.outer',
['[G'] = '@block.outer',
},
},
swap = {
enable = true,
swap_next = {
['<M-C-L>'] = '@parameter.inner',
['<M-C-Right>'] = '@parameter.inner',
},
swap_previous = {
['<M-C-H>'] = '@parameter.inner',
['<M-C-Left>'] = '@parameter.inner',
},
},
lsp_interop = {
enable = true,
border = 'solid',
peek_definition_code = {
['<C-k>'] = '@function.outer',
},
},
},
})