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
wruza#
See also

  ZZ
  :silent! wa
nicolaslem1 reply#
I am surprised it is not already mentioned in the comments, but I personally cannot use an editor that doesn't automatically write changes when I am done typing. I just forget to save and wonder why the app I am working on did not change. So my (neo)vim setup uses a plugin like `Pocco81/auto-save.nvim`.

This solves the problem mentioned by OP because I can just `:q` anytime.

DwnVoteHoneyPot1 reply#
I really hate autosave. I like using saving like a checkpoint where i have the ultimate undo button by ditching the unsaved changes.

Second, in a large Excel file, the auto save is constantly slowing me down because there’s a slight hang after every cell change.

RMPR#
> I really hate autosave. I like using saving like a checkpoint where i have the ultimate undo button by ditching the unsaved changes.

Although I don't use autosave, I don't think it matters that much with vim because you can always use undotree[0]
0: https://github.com/mbbill/undotree

bxparks#
I map 'S' to this in my .vimrc:

    nmap S :wall
which saves all changed buffers into their respective files.

It is probably the single most productive customization in my .vimrc file. I save my files very often, and I usually have multiple files and buffers open. 'cc' is an alias for the old 'S', so I don't lose much.

thayne#
You can also use ZZ. It is equivalent to :x

Load more comments