vim: Fix % motion edge case (#39620)

Update Vim's `%` motion to first attempt finding the exact matching
bracket/tag under the cursor, then fall back to the previous
nearest-enclosing logic if none is found. This prevents accidentally
jumping to nested pairs in languages like TSX and Svelte where `<>`,
`</>`, and `/>` are also treated as brackets.

Closes #39368 

Release Notes:

- Fixed an edge case with the `%` motion in vim, where the cursor could
end up in a closing HTML tag instead of the matching bracket
This commit is contained in:
Dino
2025-10-08 13:49:55 +01:00
committed by GitHub
parent a9455eb947
commit 057b7b1543
5 changed files with 148 additions and 6 deletions
@@ -0,0 +1,5 @@
{"Put":{"state":"<Button onClick=ˇ{() => {}}></Button>"}}
{"Key":"%"}
{"Get":{"state":"<Button onClick={() => {}ˇ}></Button>","mode":"Normal"}}
{"Key":"%"}
{"Get":{"state":"<Button onClick=ˇ{() => {}}></Button>","mode":"Normal"}}