How to temporarily exit Vim and go back

vim
Ricky picture Ricky · Dec 10, 2009 · Viewed 148.4k times · Source

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

Answer

zen picture zen · Dec 10, 2009

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.