folke / flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Apache License 2.0
2.39k stars 30 forks source link

feature: More treesitter selection options #220

Open simonmandlik opened 1 year ago

simonmandlik commented 1 year ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

Would it be possible to customize ; and , keys for treesitter selection? Would it be possible to prevent wrapping when increasing/decreasing selection?

Describe the solution you'd like

A possibility to specify keys e.g. in opts.modes.treesitter.keys.

Setting opts.modes.treesitter.search.wrap to false would prevent wrapping

Describe alternatives you've considered

-

Additional context

Thank you very much for the great plugin!

ajvondrak commented 9 months ago

Would it be possible to customize ; and , keys for treesitter selection?

+1 for this. It seems that ; and , are hard-coded: https://github.com/folke/flash.nvim/blob/48817af25f51c0590653bbc290866e4890fe1cbe/lua/flash/plugins/treesitter.lua#L130-L141 I think it would be natural enough to have a configuration option similar to char_actions: https://github.com/folke/flash.nvim/blob/48817af25f51c0590653bbc290866e4890fe1cbe/lua/flash/config.lua#L194-L205 https://github.com/folke/flash.nvim/blob/48817af25f51c0590653bbc290866e4890fe1cbe/lua/flash/plugins/char.lua#L197-L205

ajvondrak commented 9 months ago

Would it be possible to prevent wrapping when increasing/decreasing selection?

+1 on this as well, but I'm having a harder time tracing down which part of the code is responsible for wrapping the node search. 😅 It doesn't seem to be as simple as adding a wrap = false config to places like https://github.com/folke/flash.nvim/blob/48817af25f51c0590653bbc290866e4890fe1cbe/lua/flash/plugins/treesitter.lua#L112 or https://github.com/folke/flash.nvim/blob/48817af25f51c0590653bbc290866e4890fe1cbe/lua/flash/plugins/treesitter.lua#L131-L133 Seems like there might be more logic controlling for it somewhere—maybe get_nodes? Anyway, I assume it's possible, lol.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

simonmandlik commented 2 months ago

please keep

github-actions[bot] commented 4 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

simonmandlik commented 4 weeks ago

please keep