A better way which I use (and love these days) to jump between terminal (interactive mode with all alias
and path
set) and vim is using CTRL+Z in normal
mode. Work on terminal, and when done type fg
to return back to vim right where I left.
CTRL+Z Suspend Vim, like :stop
. Works in
Normal and in Visual mode.
1. Suspend and resume
Like most Unix programs Vim can be suspended by pressing CTRL-Z. This stops
Vim and takes you back to the shell it was started in. You can then do any
other commands until you are bored with them. Then bring back Vim with the
"fg" command.
CTRL-Z
{any sequence of shell commands}
fg
You are right back where you left Vim, nothing has changed.
In case pressing CTRL-Z doesn't work, you can also use ":suspend".
Don't forget to bring Vim back to the foreground, you would lose any changes
that you made!
Only Unix has support for this. On other systems Vim will start a
shell for you. This also has the functionality of being able to
execute shell commands. But it's a new shell, not the one that you
started Vim from. When you are running the GUI you can't go back to
the shell where Vim was started. CTRL-Z will minimize the Vim window
instead.
2. Starting new shell
You can start a new shell this way:
:term[inal] // for nvim users
:shell // (depricated in nvim)
This is similar to using CTRL-Z to suspend Vim. The difference is that a newnshell is started. Exit back to vim hitting CTRL+D
:h terminal-use
):h terminal-typing