-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Labels
A-helix-termArea: Helix term improvementsArea: Helix term improvementsC-enhancementCategory: ImprovementsCategory: Improvements
Description
Related issue:
About mapping ZZ
to :x
: #2041 (comment)
Steps to reproduce:
- Use the keybind config:
[keys.normal] Z = { Q = ":quit!", Z = ":x" }
- Open an empty Helix:
$ hx
- Type
ZZ
to quit.
What to expect:
Helix should exit.
What to observe:
Error message: cannot write a buffer without a filename
Workaround
In Vim, a similar keybinding is called ZQ
, which triggers :quit!
.
You can use ZQ
in this situation.
Why ZZ doesn't work in Helix?
There is a difference in Helix's :x
command comparing with Vim's.
In Vim:
:wq
means save and quit, no matter the file has been modified or not.:x
(:xit
) means if the file has been modified, save and quit, otherwise directly quit.- For an empty unnamed buffer,
:x
works without a filename, while:wq
doesn't.
However in Helix:
:x
is an alias to:wq
.- Both save and quit, even with no changes or with external changes.
- For an empty unnamed buffer, both don't work without a filename.
Proposed solutions
Make :x
different from :wq
.
Besides the benefit of being able to :x
an empty unnamed buffer, the original behavior of :x
is important when the file is changed from another application: You usually don't want to overwrite that change.
MarlieChiller, Zoybean, ab, kimrutherford, Minemobs and 8 more
Metadata
Metadata
Assignees
Labels
A-helix-termArea: Helix term improvementsArea: Helix term improvementsC-enhancementCategory: ImprovementsCategory: Improvements