# vim: Continue multiline comments with \`o\` \(\#63751\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 52af3dd60ca849dcd62e56c8eda4d583f3dae40c

Requested commit: 52af3dd60ca849dcd62e56c8eda4d583f3dae40c

Commit: 52af3dd60ca849dcd62e56c8eda4d583f3dae40c

Tree: 1a57734838c893d248133c8cffdce9861b408b4d

Author: Ibrahim Khan

Committer: GitHub

## Message

```
vim: Continue multiline comments with `o` (#63751)

# Objective

In Vim mode, pressing `o` to open a line inside a documentation-style
block comment preserves indentation but drops the `* ` prefix.

The behavior for pressing Return is already correct as it continues this
prefix in the next line.

This change makes both actions behave consistently.

Fixes #55049

## Solution

Make Vim’s `o` and `O` commands copy documentation-comment prefixes such
as `* ` onto the new line. This happens only when the current line is
parsed as a comment.

Also added regression coverage for this and folded it into the existing
`test_o_comment` test.

## Testing

- `CC=clang CXX=clang++ cargo test -p vim test_o_comment -- --nocapture`
- `CC=clang CXX=clang++ cargo test -p vim`
- `CC=clang CXX=clang++ cargo test -p multi_buffer`
- `cargo fmt --all -- --check`
- `CC=clang CXX=clang++ ./script/clippy -p vim -p multi_buffer`
- Tested on Linux aarch64.

## Self-Review Checklist:

- [x] I reviewed the diff for quality, security, and reliability
- [x] Unsafe blocks, if any, have justifying comments
- [x] The content adheres to the Zed UI standards
- [x] Tests cover the changed behavior
- [x] Performance impact is acceptable

---

Release Notes:

- Fixed Vim `o` comment continuation in C-style multiline comments.
```

## Parents

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

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