shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Request for interface to retrieve start and end lines of the current work chunk #100

Closed theSprog closed 2 months ago

theSprog commented 3 months ago

Is your feature request related to a problem? Please describe. While the plugin effectively highlights the current chunk with left-side numbers, it does not seem to offer a direct method to programmatically access the start_line and end_line of the highlighted chunk. This limitation makes it cumbersome for subsequent operations like selecting these lines using V-Line mode in Neovim.

Describe the solution you'd like It would be highly beneficial if hlchunk.nvim could expose an interface to directly retrieve the start_line and end_line of the currently active work chunk. This functionality would greatly enhance workflow efficiency by allowing automatic line selection based on the chunk boundaries.

Describe alternatives you've considered If direct access to these lines isn't currently supported, are there any alternative methods or workarounds that you would recommend? Additionally, if this feature is not on your roadmap, could it be considered for inclusion in future updates?

Additional context The ability to fetch these lines programmatically would enable more complex text manipulation tasks and integrations with other plugins, thereby increasing the usability of hlchunk.nvim for power users.

theSprog commented 3 months ago

由于看到作者的 readme 中提供了中文,以及文档中专门有一个 zh doc,所以猜测作者应该是位国人(猜错了不要打我😝

如果我的英文表达不够清晰(翻译的),我的想法就是能不能暴露出一个接口,使得我可以直接获取左侧高亮数字(line_num)功能的 start_line 和 end_line,这样我就可以用这个接口,自定义一些函数(例如立即以 V-lines 模式选中和 line_num 匹配的 lines),这使得一些选中操作会变得十分便捷

shellRaining commented 3 months ago

没错,实际上也提供了类似的功能。chunk 部分提供了 textobject 的字段,你可以看一下我的 neovim hlchunk 配置,我自定义为了 ic,就可以实现类似 vic dic 这样的操作。

还有抱歉的是,最近忙着找工作,重心转移到其他地方了,issue 和 pr 暂时没有心思处理。等过两天休息好了我在尝试捡起这个项目。

theSprog commented 3 months ago

Okk,没事。 我看 readme 中写 (the author is a student with a lot of time to maintain this plugin, haha)。同为学生,我也是把自己的 nvim 折腾着玩。 现在就业形势确实有点难,祝你找到满意的工作😉

shellRaining commented 2 months ago

近期比较空闲,我会完善一下文档~ 如果有问题可以 reopen Recently quite free, I will improve the document