# vim: Fix % motion edge case \(\#39620\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/057b7b154379c1f2dd8e61d7ac5b2af078e69aed)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 057b7b154379c1f2dd8e61d7ac5b2af078e69aed

Requested commit: 057b7b154379c1f2dd8e61d7ac5b2af078e69aed

Commit: 057b7b154379c1f2dd8e61d7ac5b2af078e69aed

Tree: d7a5c4f2a03622910de9091a005f927c2cb869a9

Author: Dino

Committer: GitHub

## Message

```
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
```

## Parents

- [a9455eb947bce374a6b10974b4a119d255ec4061](https://git.cafe/gitcafe/zed/commit/a9455eb947bce374a6b10974b4a119d255ec4061?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/057b7b154379c1f2dd8e61d7ac5b2af078e69aed?format=markdown)
