Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to temporarily exit Vim and go back

Tags:

vim

How could I exit Vim, not :q, and then go back to continue editing?

like image 831
Ricky Avatar asked Dec 10 '09 07:12

Ricky


People also ask

How do I go back to Vim?

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.

How do you exit and quit in Vim?

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.

How do I go back to terminal in vi editor?

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.


1 Answers

Assuming terminal Vim on a flavor of *nix:

To suspend your running Vim

Ctrl + Z

will suspend the process and get back to your shell

fg 

will resume (bring to foreground) your suspended Vim.

To start a new shell

Start a subshell using:

:sh 

(as configured by)

:set shell? 

or

:!bash 

followed by:

Ctrl+D (or exit, but why type so much?)

to kill the shell and return to Vim.

like image 58
zen Avatar answered Sep 21 '22 09:09

zen