Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
537 points`:x` leaves the modification time of files untouched if nothing was changed.
:help :x
Like ":wq", but write only when changes have been made.
Comments (270) 59 threads
Show all comments
Showing thread 1 of 59
After that, I switched to `:wq` (and sometimes `:w` `:q`) which is much safer against over-typing.
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.
Continue this thread — 3 replies
ZZ is just.. random?
Continue this thread — 2 replies
I'm toying with either disabling it,
or, mapping it down to a lower 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.
That said, given that neovim doesn't have this feature at all makes it less of an issue to me.
Continue this thread — 5 replies
Which is still to prompt? A person could take their chances.
Besides, wouldn't that form of intentionally aversive conditioning actually boost the learning rate and create hyperassociations to the behavior your're attempting to stimulus extinct or just learn over?
FWIW, I switched to :wq for a while but I'm back to using :x instead of :wq. I'm just very careful now. :)
https://news.ycombinator.com/item?id=34290590
vimrc excerpt:
I hate having to get the shift key timing correct so much that I also aliased : to ; for commands, but that's more radical and gets me into trouble on remote systems that are not my own, not sure if I recommend it. I'd recommend vim to change the default for everyone, though (fat chance, I know).Another annoying thing in vim is whatever the heck Q does. Try to type :q, fail, retry, and now suddenly you have an extra window to close or something. Solution: nnoremap Q
> vim encryption uses old, obsolete algorithms that are poorly implemented. Since insecure cryptography is worse than no cryptgraphy, the community voted in favor of removing all crypto.
Continue this thread — 9 replies
Continue this thread — 8 more replies