diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-13 00:07:04 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-13 00:07:04 +0200 |
commit | 1045611756ece10a9f54ffcd4f997feffff20389 (patch) | |
tree | 9c0a4e919be2d6d66cd25be997dc717a8bcff99b | |
parent | dcc38607f207af8e2c0cebe36e49018929057f1b (diff) |
nvim: Make use of treesitter textobjects
-rw-r--r-- | .config/nvim/after/plugin/treesitter.lua | 47 | ||||
-rw-r--r-- | .config/nvim/lua/mango/packer.lua | 8 |
2 files changed, 54 insertions, 1 deletions
diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua index ad7f027..9b14eae 100644 --- a/.config/nvim/after/plugin/treesitter.lua +++ b/.config/nvim/after/plugin/treesitter.lua @@ -20,4 +20,51 @@ require('nvim-treesitter.configs').setup { enable = true, additional_vim_regex_highlighting = false, }, + + indent = { + enable = true, + }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = '<C-Space>', + node_incremental = '<C-Space>', + scope_incremental = '<C-s>', + node_decremental = '<C-Backspace>', + } + }, + + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ab'] = '@block.outer', + ['ib'] = '@block.inner', + }, + }, + move = { + enable = true, + set_jumps = true, + goto_next_start = { + [']f'] = '@function.outer', + [']b'] = '@block.outer', + }, + goto_next_end = { + [']F'] = '@function.outer', + [']B'] = '@block.outer', + }, + goto_previous_start = { + ['[f'] = '@function.outer', + ['[b'] = '@block.outer', + }, + goto_previous_end = { + ['[F'] = '@function.outer', + ['[B'] = '@block.outer', + }, + }, + }, } diff --git a/.config/nvim/lua/mango/packer.lua b/.config/nvim/lua/mango/packer.lua index ac0af6c..3578a1f 100644 --- a/.config/nvim/lua/mango/packer.lua +++ b/.config/nvim/lua/mango/packer.lua @@ -17,7 +17,13 @@ return require('packer').startup(function(use) end } - use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) + use { + 'nvim-treesitter/nvim-treesitter-textobjects', + after = 'nvim-treesitter', + requires = 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + } + use 'mbbill/undotree' use 'tpope/vim-fugitive' |