nvim-treesitter-textobjects icon indicating copy to clipboard operation
nvim-treesitter-textobjects copied to clipboard

How to make TSTextobjectSelect command work with <cmd> in visual mode?

Open weilbith opened this issue 4 years ago • 0 comments

Hey guys, I prefer to use <cmd> for my mappings in general for all the documented benefits (always clean commands, no silent required, performance, clean command history, ...). Unfortunately this does not work for the TSTextobjectSelect command in visual mode.

This mapping does not work. The result is that the visual selections gets quit and and cursor jumps to the end of the textobject (here the function).

vnoremap af <cmd>TSTextobjectSelect @function.outer<CR>

But it works if I write the mapping like this:

vnoremap af :<C-u>TSTextobjectSelect @function.outer<CR>

Is it possible to patch the command to work with the <cmd> mapping syntax?

weilbith avatar Mar 01 '21 10:03 weilbith