I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
61–70 of 279 posts
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#62I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
Thanks for this warning. Even worse for me, because my laptop keyboard has some kind of horrible encoding causing latency on the shift key, so I'm constantly doing :Wq when I type fast enough... Yeah I had the suspicion it was human error - but I've tested using a single finger for shift and w, so it's definitely the keyboard. [edit] Looks like that feature is not necessarily built in by default though.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#63I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
FWIW, I switched to :wq for a while but I'm back to using :x instead of :wq. I'm just very careful now. :)
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#64I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
Thanks for bringing this up. I'm toying with either disabling it, cmap X or, mapping it down to a lower x. cmap X x 1. Does anyone see anything this could interfere with? 2. Does anyone know a better way to turn off the `:X` encryption option? Sadly, having to remap definitely dulls the shine of `:x`.
Otherwise, I feel a remap is just a valid option as any to disable it. I'm not sure there's a way (a quick skim of the docs made me think `set key=` would do it but that didn't work for me, or at least I didn't understand what it does) but either way you'd still have to add config.
But again, as I say to everyone I see using commands to quit and keeps getting brought up here: `ZZ` is the same thing.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#65I learned to do `:wq` after I learned that `:X` encrypts your file. When typing without really paying attention to the screen, I've twice encrypted my file with password like `cd tmp`, then saved the config file, breaking my system. After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#66Earlier quoted context omitted.
I just tried this and I think that in 40ish years of typing on computer keyboards, this is the most difficult thing I've ever typed. And I use emacs.
What do you mean? Super easy and fluid, I've been doing it for about a decade. Left pinky on left shift, left middle finger (you could try ring I suppose) on zz, tap twice.
Blame my hand geometry or the keyboard or muscle memory or 10,000 other things, I just noted it was super hard and unnatural for me to type that. (The downvoting on that is pretty epic, though.)
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#67Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#68If I changed something intentionally, :wq and :x are equivalent. If I changed something accidentally, :x won’t catch that, and :q complaining will require me to decide if :q! or :wq is correct.
So :x does not fit my workflow of avoiding accidental writes. Just like ZZ does not.
Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#69Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
#70I always :q when I didn’t change anything. If I changed something intentionally, :wq and :x are equivalent. If I changed something accidentally, :x won’t catch that, and :q complaining will require me to decide if :q! or :wq is correct. So :x does not fit my workflow of avoiding accidental writes. Just like ZZ does not.