nvim-treesitter / nvim-treesitter-textobjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to repeat selection?

xbladesub opened this issue · comments

commented

For example I want to select next function with vaf and repeat this to select next/previous function with ; or backwards with ,. Is it possible to do with nvim-treesitter-textobject? If no, maybe some other plugin/hack/workaround?

; and , are for move commands, not select. You can repeat specific action using . but maybe not for select.

One simple way to approach it is to add your own mapping. Make a function that performs selection and remember the query used for selection. Map the function to keys you like. Lastly, add the function to this plugin's repeatable move commands (see readme). ; and , will now repeat the previous function.