How could I exit Vim, not :q
, and then go back to continue editing?
Undo Changes in Vim / Vi To undo changes in Vim and Vi use the u , :u or :undo commands: If you are in insert or any other mode, press the Esc key to go back to the normal mode, which is also known as command mode. Type u to undo the last change.
TL;DR – How to Exit Vim If you made some changes and would like to keep them, type :wq and press Enter / return. If you made some changes and would rather discard them, type :q! and press Enter / return.
If you've made mistakes along the way in your editing and want to back out (abandon) all non-saved changes, enter Command mode by pressing Esc and type :q! This command quits without saving any changes and exits vi.
Assuming terminal Vim on a flavor of *nix:
Ctrl + Z
will suspend the process and get back to your shell
fg
will resume (bring to foreground) your suspended Vim.
Start a subshell using:
:sh
(as configured by)
:set shell?
:!bash
followed by:
Ctrl+D (or exit
, but why type so much?)
to kill the shell and return to Vim.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With