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
shiomiru1 reply#
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.
lionkor#
With a German keyboard, which I use, Z and Y are swapped - so even more reason to use :wq
1-KB-OK#
I've been using `:x` successfully for years after finding it. I had no idea that `:X` actually encrypts the file and can cause havoc lol.
tempodox#
... and you can append `a` (`:xa`) to write out all modified buffers and quit.
warrenm1 reply#
I had a CS prof years ago tell us all the only thing we needed to know about vi(m) was the dammit key

As in "escape-q-dammit"

manaskarekar3 replies#
Just throwing another one out there:

    `Ctrl + [`  instead of `Esc` to save some finger travel.
cassepipe#
Too fundamental of a key to even be a combination IMHO. I terminate each edit operation by it, like a dot at the end of a sentence, it needs to be a half a second operation so I can spend most of my time in normal mode.

I just remap Caps Lock to Esc system wise (a setting in both Linuxes and MacOs) and use both shift for Caps Lock (setting on Linux, Idk about MacOS)
I have always found the "jk" solution quite elegant although I don't use it
The benefit of using it system wise is that it then works with all programs that have a vi mode (zsh, gdbtui, etc.)

jeffbee1 reply#
ctrl+c is the same and even easier to type. I never use escape.
avgcorrection4 replies#
That’s not the exact same as Escape.

Continue this thread — 4 replies

Load more comments