File Manipulation
Note: to use a colon (:) command, get into command mode then press ':'.
- :r filename <CR>
Reads in a copy of the file specified on the line after the current line. (if no filename is given, the file you are editing is read in from disk)
- :w<CR>
Write edit buffer to original file (This assumes that you started vi by typing vi <filename>).
- :w filename <CR>
Write edit buffer to named file.
- :wq <CR> or ZZ <CR>
Write edit buffer to original file, then exit vi.
- :e newfilename <CR>
Start editing a new file.
- :q <CR>
Quit with a warning if edit buffer not saved.
- :q! <CR>
Quit with no warning. If edit buffer has not been saved to a file, it will be lost.