nvim-treesitter / nvim-treesitter-textobjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accept counts for movements and selections

Bekaboo opened this issue · comments

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

It would be good if movements like @function.outer can accept a prefix number as count just like many other vim default keymaps, e.g. use ]] to go to the next function and 2]] goes to the second next function. Similarly, if am is mapped to select around a function then 2vam or v2am should select the outer function that wraps the current function.

Describe the solution you'd like
See above

Describe alternatives you've considered
N/A

Additional context
Seems like it has been discussed in #8 but no further updates about it so far. Accepting prefix counts makes the keymaps more consistent with vim's builtin motions and can reduce keystrokes needed to jump to the desired location, please consider implementing it.
Thanks in advance!

It already accepts count for movement operation. Not for the selection though. I don't think any vim motions support selection with counts as they could be not continuous. For example, 2da( will do nothing.

I'd recommend using ; and , to repeat movements in visual mode. This will do what you want.

Thanks for your explaination!