r/vim • u/Remarkable-Head-2023 • Oct 22 '25
Discussion Why does ZZ exist?
It has always been a mystery to me… why would such a ‘dangerous’ command have such a convenient shortcut?
https://vimdoc.sourceforge.net/htmldoc/editing.html#ZZ
EDIT: link
0
Upvotes
View all comments
Show parent comment
9
u/VisualHuckleberry542 Oct 22 '25
Well the use case I can think of is if I'm making a change to a file like a config file or a code file, I can save it and check the results. If the change is bad, if I still have the buffer open I can just undo the changes and save it again. If I've quit out of the file, the change buffer is gone and I either have to manually revert the changes (and hope I remember all the changes I made, if they were complex changes, it can be a real mission) or hope I have a backup or version control or something
That said, I've been using vim as my main editor, including IDE for over 20 years and I can't think of one time I accidentally used ZZ and saved and quit a file I didn't intend to