Lurker News
`: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

Earlier comments
cyberge992 replies#
Shift Z Z will instantly save and exit, same as wq!
Tepix#
Isn't it like ":x"?
ergonaught2 replies#
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.
amalgamated_inc1 reply#
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.
ergonaught1 reply#
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.)

Continue this thread — 1 reply

favadi#
I don't think C-x C-s + C-x C-q is any easier.
amelius3 replies#
By the way, why does visudo sometimes give me another editor (like nano) on a new system. Isn't "vi" supposed to mean "vi"?
tingletech#
I think it uses whatever EDITOR is set to.

  EDITOR=vi visudo
should let you override it
layer8#
You're showing that you didn't read the second paragraph of the visudo man page yet.
lucb1e#
This is why I always 'sudo vim /etc/sudoers'. I don't want to have to deal with using and exiting nano somehow (that I need to edit sudoers means that the system isn't properly set up, so odds are that there won't be vim configured as default editor yet either).

Of course, one should make one's own risk assessment here. It's not as though visudo can read your mind and prevent you from locking yourself out or something, so if you are on a system where you can't fall back to modifying the file on the (virtual) disk directly, you might want to first open a second shell and test your changes after saving and before quitting either vim or visudo.

bitwize#
I've been using ZZ all these years

Load more comments