Hi! I built this small plugin that adds JSX/TSX text-objects and motions using Treesitter: jsx-element.nvim. I was surprised that it (to my knowledge) doesn't exist yet.
Use ]t
/[t
to go to the next/previous JSX/TSX element.
Use it
/at
to use JSX/TSX elements as text-objects. For example dit
for "delete inside tag". This works with self-closing elements:
<Checkbox value="checkedA" />
╰───── it ─────╯
╰─────────── at ────────────╯
It also works with paired elements:
<Button variant="text">This is a button</Button>
╰───── it ─────╯
╰───────────────────── at ─────────────────────╯