Skip to content

Multi-line comment textobject #1234

Closed Answered by echasnovski
julien-h2 asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately, it is not an easy thing to do. The reason is because in order to make this work with "next"/"prev" search methods, 'mini.ai' needs to know about them when deciding which one to choose. The built-in commenting was designed to exclusively used interactively, so it doesn't provide any (stable) Lua API.

The best approach to solve what you are asking for is to manually write a textobject specification as a function that returns an array of regions representing all consecutive comment blocks. Depending on how robust and capable you want it to be, implementation can span from maybe about 15 lines to at least 50.

However, the most reasonable approach to solve the problem I'd say is…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by julien-h2
Comment options

You must be logged in to vote
2 replies
@echasnovski
Comment options

@julien-h2
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants