diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index b2e4868..91558b9 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -382,6 +382,26 @@ require'nvim-treesitter.configs'.setup { 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