-
-
Notifications
You must be signed in to change notification settings - Fork 14
Description
title: Saving and exiting files
path: vim/saving-and-exiting-files.md
Source: https://docstore.mik.ua/orelly/unix3/vi/ch05_03.htm
-
:wWrites (saves) the buffer to the file but does not exit. You can (and should) use:wthroughout your editing session to protect your edits against system failure or a major editing error. -
:qQuits the editor (and returns to the UNIX prompt). -
:wqBoth writes the file and quits the editor. The write happens unconditionally, even if the file was not changed. -
:xBoth writes the file and quits (exits) the editor. The file is written only if it has been modified. -
What's the difference between
:wqand:x? Modification time. If you:xa buffer that hasn’t changed, the modification time will be untouched because the file isn’t re-saved. The:wqcommand will alter the modification time no matter what.