To wipe all changes made to a file since opening it in vi or vim, you can use the :e!
command to discard all changes and reload the file from disk. This command will discard all changes made to the file since it was last saved, including any new text that has been added or any text that has been deleted.
For example, to discard all changes made to the file file.txt
and reload it from disk, you can use the following command:
:e!
Alternatively, you can use the :q!
command to exit vi or vim without saving any changes. This command will exit the editor and discard all changes made to the file since it was last saved.
For example, to exit vi or vim and discard all changes made to the file file.txt
, you can use the following command:
:q!