When using vim
from the command line, you can suspend vim
and get back to your prompt, without actually quitting vim
. Hence you will later be able to get back your vim
session from the same prompt.
When in Normal mode (if not, press esc to get there), issue either of these commands:
:st
enter
:sus
enter
:stop
enter
:suspend
enter
Alternatively, on some systems, when in Normal or Visual mode, issuing Ctrl+Z will have the same effect.
Note: If autowrite
is set, buffers with changes and filenames will be written out. Add a !
before enter to avoid, eg. :st!
enter.
Later, when you want to return to your vim
session, if you haven't suspended any other jobs, issuing the following will restore vim as your foreground job.
fg
enter
Otherwise you will need to find your vim
sessions's job ID by issuing jobs
enter and then foregrounding the matching jobs fg %[job ID]
enter eg. fg %1
enter.