Tell HN: Vim users, `:x` is like `:wq` but writes only when changes are made
537 points`: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 commentsI only knew about :x. So thus far I’ve only edited with :x, and then used :q! to quit without writing the changes.
Anyway, it would be great to have a default shortcut for this combination of keys too.
Incidentally, I find :w to be very inefficient to type (any : command really, but there are not normally the most common operations), for such a common operation. I wonder if people remap it.
nore ; :
You can remap your keyboard as well.
Fun fact, ZQ quits without saving, like :q!
All comments shown.
Couldn't load more comments. Check your connection and try again.