summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-11-07 23:25:15 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-11-07 23:25:15 +0100
commitde9c462c436a3ce2d1bd4a406d3f0bf3700bd650 (patch)
tree3d3f8c192a552dcef3c5ddac327d8b98844c66aa /.config/nvim
parent4faa34938169a5d116c8cd75335f0a5a125f2eaa (diff)
nvim: Add a tree-sitter textobject for comments
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/after/plugin/treesitter.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua
index 82d4f0d..1ffb294 100644
--- a/.config/nvim/after/plugin/treesitter.lua
+++ b/.config/nvim/after/plugin/treesitter.lua
@@ -53,10 +53,12 @@ require('nvim-treesitter.configs').setup {
enable = true,
lookahead = true,
keymaps = {
- ['af'] = '@function.outer',
- ['if'] = '@function.inner',
['ab'] = '@block.outer',
['ib'] = '@block.inner',
+ ['ac'] = '@comment.outer',
+ ['ic'] = '@comment.inner',
+ ['af'] = '@function.outer',
+ ['if'] = '@function.inner',
['an'] = '@node.outer',
['in'] = '@node.inner',
},
@@ -65,21 +67,25 @@ require('nvim-treesitter.configs').setup {
enable = true,
set_jumps = true,
goto_next_start = {
+ [']c'] = '@comment.outer',
[']f'] = '@function.outer',
[']b'] = '@block.outer',
[']n'] = '@node.outer',
},
goto_next_end = {
+ [']C'] = '@comment.outer',
[']F'] = '@function.outer',
[']B'] = '@block.outer',
[']N'] = '@node.outer',
},
goto_previous_start = {
+ ['[c'] = '@comment.outer',
['[f'] = '@function.outer',
['[b'] = '@block.outer',
['[n'] = '@node.outer',
},
goto_previous_end = {
+ ['[C'] = '@comment.outer',
['[F'] = '@function.outer',
['[B'] = '@block.outer',
['[N'] = '@node.outer',