From de9c462c436a3ce2d1bd4a406d3f0bf3700bd650 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 7 Nov 2023 23:25:15 +0100 Subject: nvim: Add a tree-sitter textobject for comments --- .config/nvim/after/plugin/treesitter.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to '.config') 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', -- cgit v1.2.3