diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 34e6d28..fc265c8 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -43,6 +43,9 @@ require('lazy').setup({ { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, }, }) @@ -120,6 +123,49 @@ require'nvim-treesitter.configs'.setup { indent = { enable = true, }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, }