Book HomeBook TitleSearch this book

8.4. Saving and Exiting

Writing a file means saving the edits and updating the file's modification time.

ZZQuit vi, writing the file only if changes were made.
:xSame as ZZ.
:wqWrite and quit file.
:wWrite file.
:w fileSave copy to file.
:n,mw fileWrite lines n to m to new file.
:n,mw >> fileAppend lines n to m to existing file.
:w!Write file (overriding protection).
:w! fileOverwrite file with current buffer.
:w %.newWrite current buffer named file as file.new.
:qQuit vi.
:q!Quit vi (discarding edits).
QQuit vi and invoke ex.
:viReturn to vi after Q command.
:e file2Edit file2 without leaving vi.
:nEdit next file.
:e!Return to version of current file at time of last write.
:e #Edit alternate file.
%Current filename.
#Alternate filename.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.