Re:Vim Anywhere
by always_good on Saturday February 17, 2018 @11:13AM
(#16401274)
:x is a shortcut for :wq. I wonder why nobody knows it.
[ Parent
| on HN ]
:x is not only a short for :wq - the latter saves (unconditionally, even if you have saved earlier and not edited since), and then quits (the file). I was going to say that :x is also a shortcut for :q (just quit) but it is of course not a shortcut for that, since it is the same length :)
I can better describe it like this:
:x is a shortcut for telling vi/vim: save the file if not saved after last change, then quit (in either case, whether a save was needed and done just now or not) - IIRC.
Also, as others said, Shift-ZZ (when Caps Lock is off), also saves and quits (and saves one keystroke over :x - because you have to hit Enter after :x, but not after Shift-ZZ :) It is also (slightly) faster to type, since the (left) Shift key is just next to the Z key (at least on some keyboards, like mine at present).
Re:Vim Anywhere
by BenjiWiebe on Saturday February 17, 2018 @05:08PM
(#16403021)
I've never used :wq, always :x. And I've been using vim for roughly 3 years.
Re:Vim Anywhere
by applecrazy on Sunday February 18, 2018 @05:17PM
(#16409117)
Sorry, I’m pretty new to vim (switched from ST this week and loving it so far). Thanks for the advice though