Closed
Description
Tree-sitter based textobject motions (for example ]f
/[f
) do not currently have different implementations between normal mode and select mode (v
).
The behavior of these motions in select mode is worth some discussion. I see two options:
- Like
]p
/[p
orw
/b
in select mode, they should keep the anchor and move the head. This "extend" behavior is the normal behavior of motions in select mode. There is prior implementation-work for this behavior: Include treesitter objects in select mode #2802. (I'm looking at pulling this across the finish line now.) - Like
n
/N
, they should add new selections containing the next/previous textobject.
Option 2 is a bit unconventional (n
/N
is the only other that uses this behavior off the top of my head) but I think it would be more useful. Tree-sitter textobjects may not be contiguous in a file in the same way paragraphs are (by ]p
/[p
's definitions), so I think v]f
would select other text between two function definitions I would not want. Even if this is not selected as the correct behavior, it might be good to adding separate commands that implement this behavior.