zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.24k stars 2.73k forks source link

vim mode `:cquit` closes Zed instead of single buffer #17522

Open oliverlee opened 1 week ago

oliverlee commented 1 week ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Vim mode :cquit closes Zed instead of single buffer. I expect this to close a single buffer, without saving, with a nonzero exit code. I typically use this to cancel a git commit.

Environment

Zed: v0.151.2 (Zed) OS: macOS 14.6.1 Memory: 8 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


mrnugget commented 6 days ago

I'm not sure whether this is a bug. In Vim/Neovim :cquit closes the whole editor, not a single buffer: https://neovim.io/doc/user/quickfix.html#%3Acquit

oliverlee commented 4 days ago

Is there an alternate command that can be used to close a buffer with with a non-zero exit code?

mrnugget commented 4 days ago

I don't think there is one right now, no. What do you want to use it for? zed --wait?

Edit: if it's for zed --wait, then maybe we can detect whether a buffer has been closed and its changed discarded and return a non-zero exit code then?

oliverlee commented 3 days ago

I typically use that to cancel a git commit.

mrnugget commented 3 days ago

How do you have git configured to use Zed as an editor? export GIT_EDITOR="zed --wait"?

oliverlee commented 2 days ago

Yeah I set EDITOR to zed --wait within Zed.

Although I've mostly been using it in a separate terminal emulator outside of Zed where EDITOR is specified as vim.