Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by sodapopcan on Saturday January 07, 2023 @10:18AM
(#34288750)
Or, as other have pointed out, just use `ZZ` which is even easier and equivilant to `:x`.
[ Parent
| on HN ]
Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by sshine on Saturday January 07, 2023 @10:59AM
(#34289244)
:q, if you didn’t make a change, is even shorter.
Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by jjallen on Saturday January 07, 2023 @11:42AM
(#34289725)
If you do this half the time you will have forgotten that you have edited the file and won't be able to exit
Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by sshine on Saturday January 07, 2023 @03:55PM
(#34292673)
If I forgot I had edited a file and I’m leaving it as if I hadn’t, I will want to know.
Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by sodapopcan on Saturday January 07, 2023 @11:18AM
(#34289446)
It's not shorter—there is an implied `<cr>` at the end there and as you have it written it's the same length. Also, if you did make a change, `:q` will yell at you. If that's what you want, though, that's totally cool.
The advantage of `ZZ` is that it can be used as a general "close this window" command. It'll work on unmodifiable buffers as well without complaining.
Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by shp0ngle on Saturday January 07, 2023 @07:59PM
(#34294869)
:wq just makes more sense to me, it’s “command: write, quit”
ZZ is just.. random?
Re:Tell HN: Vim users, `:x` is like `:wq` but writes only wh...
by sodapopcan on Sunday January 08, 2023 @01:05AM
(#34296521)
Sure, but we're talking Vim here. Is that more random than `"0p`? Or `ctl-o`? Or `ctl-6`? Mnemonics are important for operations we only perform a few times per day or every other day or less. But we're talking about a _built-in_ mapping for an operation that is performed probably as much as 1000 times per day, give or take. Convenience beats out mnemonics here because you don't need them (if you care to use it).
I also think the bikeshed should be lime green :)