Live data from Hacker News

Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

news.ycombinator.com

241–250 of 279 posts

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#241

Earlier quoted context omitted.

A sure sign of a well designed tool imo

Really? IMO that's the sign of an extremely poorly designed tool that a lot of users have learned to use very well despite how poorly it's designed. A tool that's designed well should have its actions all extremely intuitive, in which case one would not forget things in this manner because all of the actions would be derivable from their justifications. For example: ctrl+C is copy, and ctrl+V is the key right next to…

Pass grandma test with that then we’ll talk, after you close that print dialog. You’re as grown used to this “easy to remember” as any Vim user or a truck driver.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#243
post #195
post #180

Earlier quoted context omitted.

You might as well use emacs at that point.

Been using vi for just over 25 years now. The only thing I know how to do in emacs is exit :D vi uses the ctrl key a ton if you know what you are doing.

Ctrl-W based shortcuts are especially very useful.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#244
post #164
post #151

Earlier quoted context omitted.

I use :x cus it's one less keystroke. And yes, I still use :q to make sure I don't save in case I changed something by mistake.

ZZ is only 3 keystrokes as opposed to 4 for :x (shift + z + z = 3 and shift + ; + x + enter = 4). It also doesn't require timing the release of shift before the press of x.

Wow! Never knew that existed. If I can undo 20 years of muscle memory, I'll use it. :D

EDIT: Just tried it, and Z being right next to Shift is a deal breaker.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#245

Earlier quoted context omitted.

Or, as other have pointed out, just use `ZZ` which is even easier and equivilant to `:x`.

:wq just makes more sense to me, it’s “command: write, quit” ZZ is just.. random?

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 :)

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#246

Maybe it's just me, but I find :wq a lot easier to type... For :x (or worse, ZZ), I either have to move my hand or bend my ring finger/pinky to reach the keys. On the other hand, my fingers reach both w and q at the same time with very little effort.

With a German keyboard, which I use, Z and Y are swapped - so even more reason to use :wq

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#247

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.

posix vi, ovi and nvi lack an X command

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#248
post #48

See, that's why even though I'm a terminal user first and foremost, I really like the discoverability of GUIs, and that's where a good GUI is unbeatable by CLI. This would have just been an entry "Save if needed" in the File menu, right below "Save", and users would probably find it by accident while looking at the menu, even while not actively looking for new ways to save a file. (Not getting into the fact that a we…

A good GUI doesn't have a save button at all.

It saves automatically when you press compile or change focus to another window. This is how both VSCode and Intellij work. Together with a local history that allows you to go back in time to any point earlier during the day.

Writing things in stone or reverting to older state is something reserved for git.

Re: Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made

#250
post #244
post #164

Earlier quoted context omitted.

ZZ is only 3 keystrokes as opposed to 4 for :x (shift + z + z = 3 and shift + ; + x + enter = 4). It also doesn't require timing the release of shift before the press of x.

Wow! Never knew that existed. If I can undo 20 years of muscle memory, I'll use it. :D EDIT: Just tried it, and Z being right next to Shift is a deal breaker.

Why not use the other Shift if that's a problem?
Post reply on HN