# vim: Fix % for multiline comments and preprocessor directives \(\#53148\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 092c7058a49e4386afbb935740f0c220c3cafde0

Requested commit: 092c7058a49e4386afbb935740f0c220c3cafde0

Commit: 092c7058a49e4386afbb935740f0c220c3cafde0

Tree: a65135350e7cbc34f3326fd5119e8b39782edd43

Author: Juan Pablo Briones

Committer: GitHub

## Message

```
vim: Fix % for multiline comments and preprocessor directives  (#53148)

Implements:
[49806](https://github.com/zed-industries/zed/discussions/49806)
Closes: [24820](https://github.com/zed-industries/zed/issues/24820)

Zeds impl of `%` didn't handle preprocessor directives and multiline

To implement this feature for multiline comment, a tree-sitter query is
used to check if we are inside a comment range
and then replicate the logic used in brackets.

For preprocessor directives using `TextObjects` wasn't a option, so it
was implemented through a text based query
that searches for the next preprocessor directives. Using text based
queries might not be the best for performance, so I'm open to any
suggestions.

Release Notes:

- Fixed vim's matching '%' to handle multiline comments `/* */` and
preprocessor directives `#if #else #endif`.
```

## Parents

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

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