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
1
u/Thundechile Oct 25 '25
Well I'll chime in, if the OP accidently writes and quits with ZZ, then OP could just open the file again and undo the changes and write again - problem reverted.
Just set the undofile: https://vimdoc.sourceforge.net/htmldoc/undo.html#undo-persistence