Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commenting: add 'inner comment' text object #29318

Open
yochem opened this issue Jun 13, 2024 · 0 comments · May be fixed by #29428
Open

commenting: add 'inner comment' text object #29318

yochem opened this issue Jun 13, 2024 · 0 comments · May be fixed by #29428
Labels
comment enhancement feature request plugin plugins and Vim "pack" runtime funtime
Milestone

Comments

@yochem
Copy link
Contributor

yochem commented Jun 13, 2024

Problem

The builtin default commenting feature also ads the gc text object, so e.g. dgc allows to delete the comment block. It would also be useful if there is an 'inner comment' to delete everything but the commentstring.

Currently, this can also be done using nvim-treesitter-textobjects with the @comment.inner capture, although that works slightly different, as it does not grab the 'largest contiguous block of non-blank commented lines around the cursor'.

It's something I, and I expect others too, use quite often to rewrite a whole comment. It would be nice to not depend on nvim-treesitter-textobjects for this (small) functionality.

Expected behavior

Example:

-- this is a comment
-- block

cigc:

-- |

Where | marks the cursor position.

Or a begin-end commentstring like HTML:

<!-- html comment -->

cigc:

<!-- | -->
@yochem yochem added the enhancement feature request label Jun 13, 2024
@yochem yochem changed the title Add 'inner comment' to comment text object Add 'inner comment' to the comment text object Jun 13, 2024
@justinmk justinmk added this to the unplanned milestone Jun 17, 2024
@justinmk justinmk changed the title Add 'inner comment' to the comment text object commenting: add 'inner comment' text object Jun 17, 2024
@justinmk justinmk added plugin plugins and Vim "pack" runtime funtime labels Jun 17, 2024
@yochem yochem linked a pull request Jun 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comment enhancement feature request plugin plugins and Vim "pack" runtime funtime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants