-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnvim-treesitter-textobjects.lua
More file actions
97 lines (93 loc) · 4.25 KB
/
nvim-treesitter-textobjects.lua
File metadata and controls
97 lines (93 loc) · 4.25 KB
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
return {
"nvim-treesitter/nvim-treesitter-textobjects",
lazy = true,
dependencies = {
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.textobjects = { --{{{
select = { -- {{{
enable = true,
keymaps = {
["af"] = { query = "@function.outer", desc = "Select around a function" },
["if"] = { query = "@function.inner", desc = "Select inside a function" },
["am"] = { query = "@call.outer", desc = "Select around a method" },
["im"] = { query = "@call.inner", desc = "Select inside a method" },
["ab"] = { query = "@block.outer", desc = "Select around a block" },
["ib"] = { query = "@block.inner", desc = "Select inside a block" },
["aa"] = { query = "@parameter.outer", desc = "Select around a parameter" },
["ia"] = { query = "@parameter.inner", desc = "Select inside a parameter" },
["as"] = { query = "@statement.outer", desc = "Select around a statement" },
},
}, --}}}
move = { --{{{
enable = true,
set_jumps = true,
goto_next_start = {
["]f"] = { query = "@function.outer", desc = "Go to start of the next function" },
["]b"] = { query = "@block.outer", desc = "Go to start of the next block" },
["]gc"] = { query = "@comment.outer", desc = "Go to start of the next comment" },
["]a"] = { query = "@parameter.inner", desc = "Go to start of the next parameter" },
["]o"] = { query = "@loop.*", desc = "Go to the next loop" },
["]s"] = {
query = "@scope",
query_group = "locals",
desc = "Go to the next scope",
},
},
goto_next_end = {
["]F"] = { query = "@function.outer", desc = "Go to end of the next function" },
["]B"] = { query = "@block.outer", desc = "Go to end of the next block" },
["]A"] = { query = "@parameter.outer", desc = "Go to end of the next parameter" },
},
goto_previous_start = {
["[f"] = { query = "@function.outer", desc = "Go to start of the previous function" },
["[b"] = { query = "@block.outer", desc = "Go to start of the previous block" },
["[gc"] = { query = "@comment.outer", desc = "Go to start of the previous comment" },
["[a"] = { query = "@parameter.inner", desc = "Go to start of the previous parameter" },
["[o"] = { query = "@loop.*", desc = "Go to the previous loop" },
["[s"] = {
query = "@scope",
query_group = "locals",
desc = "Go to the previous scope",
},
},
goto_previous_end = {
["[F"] = { query = "@function.outer", desc = "Go to end of the previous function" },
["[B"] = { query = "@block.outer", desc = "Go to end of the previous block" },
["[A"] = { query = "@parameter.outer", desc = "Go to end of the previous parameter" },
},
}, --}}}
swap = { --{{{
enable = true,
swap_next = {
["<leader>.f"] = {
query = "@function.outer",
desc = "Swap around with the next function",
},
["<leader>.e"] = { query = "@element", desc = "Swap with the next element" },
["<leader>.a"] = { query = "@parameter.inner", desc = "Swap with the next parameter" },
},
swap_previous = {
["<leader>,f"] = {
query = "@function.outer",
desc = "Swap around with the previous function",
},
["<leader>,e"] = { query = "@element", desc = "Swap with the previous element" },
["<leader>,a"] = {
query = "@parameter.inner",
desc = "Swap with the previous parameter",
},
},
}, --}}}
lsp_interop = { --{{{
enable = true,
peek_definition_code = {
["<leader>df"] = { query = "@function.outer", desc = "Peek function definition" },
},
}, --}}}
} -- }}}
end,
},
enabled = require("config.util").is_enabled("nvim-treesitter/nvim-treesitter-textobjects"),
}
-- vim: fdm=marker fdl=0