nvim: ts text objects
This commit is contained in:
parent
bd13f4f51b
commit
35534e8c1c
1 changed files with 20 additions and 0 deletions
|
@ -382,6 +382,26 @@ require'nvim-treesitter.configs'.setup {
|
||||||
node_decremental = "grm",
|
node_decremental = "grm",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
["ac"] = "@class.outer",
|
||||||
|
["ic"] = "@class.inner",
|
||||||
|
|
||||||
|
-- Or you can define your own textobjects like this
|
||||||
|
["iF"] = {
|
||||||
|
python = "(function_definition) @function",
|
||||||
|
cpp = "(function_definition) @function",
|
||||||
|
c = "(function_definition) @function",
|
||||||
|
java = "(method_declaration) @function",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue