Live data from Hacker News

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

news.ycombinator.com

201–210 of 279 posts

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

#201
post #171
post #63

Earlier quoted context omitted.

I have computer-literate parents and grew up in the PC era, so as a child I typed my elementary school assignments in vi. Accidentally using :X, encrypting one of my school papers, and having to completely rewrite it, was one of the slightly-traumatizing moments in my childhood. FWIW, I switched to :wq for a while but I'm back to using :x instead of :wq. I'm just very careful now. :)

I get annoyed by ":W is not a valid command" errors and aliased it, and that's not even dangerous to get wrong, just have to retype ":w". Why be so careful instead of just aliasing it? vimrc excerpt: command Wq wq command WQ wq command W w command Q q command Bd bd cnoreabbrev q1 q! 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 i…

I used to use the W alias whenever I noticed myself doing it on a new setup, but I haven't had to do it recently. I suspect my "slow on the shift" issue was due in part to the lousy keyboards I used to use.

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

#202

Earlier quoted context omitted.

> You can also type ZZ (no colon) while in normal mode to exit and save. That's insane. What if you need to type the following words in all caps? DRIZZLE GRIZZLY BUZZARD PIZZAZZ The last would make that command from normal mode particularly annoying. Unless you meant when not in input mode... duh.

Normal mode in vim does not have the meaning normal people associate with a normal text editor.

To be fair, `normal mode' may be a vimism. Both traditional vi's and nvi's man pages refer to the vim `normal mode' as `command mode', and `insert mode' (mostly) as `input mode'. (Though :set showmode still says Insert, and `insert mode' is occasionally used on the man pages too.)

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

#203
post #179

Earlier quoted context omitted.

[dead]

I've been a vim user for 15 years and I still often type `:Q` and `:W`. Everyone types differently and some people make mistakes. Your blaming the victim instead of the software.

What parent @waisbrot is saying seems uncommon (the source of this whole conversation), but granted, perhaps common enough (or is it instead worrisome enough) that nvim community took it out.

I still type :Q and :W as well, but that is not what is being discussed.

Have you ever irrevocably bricked your system, as @waisbrot mentioned they have twice, from typing :W or :Q? Have you ever bricked your system from typing :X? If so, that isn’t a “use :x vs :wq” problem, that’s seems more of a use common sense problem.

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

#204

Earlier quoted context omitted.

It is, but accidentally hitting capslock instead of shift when hitting the colon is extremely easy to do.

Caps Lock is that key that's best replaced with Ctrl? ;)

Only for Emacs users. Vim users generally replace it with Escape.

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

#205
post #97
post #71

Earlier quoted context omitted.

:q, if you didn’t make a change, is even shorter.

If you do this half the time you will have forgotten that you have edited the file and won't be able to exit

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 when changes are made

#206

Earlier quoted context omitted.

It is, but accidentally hitting capslock instead of shift when hitting the colon is extremely easy to do.

Caps Lock is that key that's best replaced with Ctrl? ;)

What the Lord intended

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

#207

Earlier quoted context omitted.

The only reason the footgun is there is because vim put it there. Seems reasonable to me to be frustrated by that.

Then upgrade to nvim like everybody else idk

Some people value stability and gvim. I don't consider nvim an upgrade, it's just a fork with different priorities which may or may not suit you. I continue to use vim and gvim.

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

#208

Earlier quoted context omitted.

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.

I mean pretty much what I wrote. It's literally the most difficult thing I've ever typed on a keyboard. 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.)

So weird, I literally never, ever typed :wq ever again after the first time I experienced the smooth bliss of ZZ. Maybe you're right about hand geometry and it's just for me. It's satisfying in the way that whacking ESC is, but smoother and gentler.

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

#209

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…

While I agree this is the ideal, it's often hard to be newcomer-friendly while keeping a stable interface (absolutely needed to build a muscle memory). You can reduce the feature set, but then it doesn't work for power users.

An example of this is that new users often expect conventions they're used to; and both vim and emacs predate a lot of these, like Ctrl-S for saving.

Muscle memory can also be a sign for poorly designed software, where simple actions require a lot of repetitive steps. At least, it's easy to go fast with a keyboard. As an example, I learned by heart some sub-sub-menu items in Cadence, accessed by Alt+x,y,z (I'm thankful for these underlined letters in toolbars).

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

#210
post #152

Earlier quoted context omitted.

Same. Been using :x for about 20 years. Had no idea there was some similar encryption nonsense.

I've been using `rm` and `rm -rf` for as long without losing data, but I understand why some people like having a trash can. Different workflows are susceptible to different hazards.

If you're not parent, you will definitely be interested in : https://github.com/rushsteve1/trash-d
Post reply on HN