I just learned that Vim has the :terminal
command, which opens a window with a terminal session inside. Previously, my normal workflow was to launch vim from my terminal and use job control to get in and out of it (i.e. edit files, use <C-z>
to put vim in the background, interact with my shell, then use fg
to bring vim back to the foreground, then keep editing files).
Now that I know about :term
, it would be nice to incorporate it into my workflow. However, I require the ability to still be able to use the workflow mentioned above. The problem is, <C-z>
inside the terminal window inside vim gets interpreted by that window's shell. According to :help terminal-typing
, using <C-w> N
will enter Terminal-Normal mode. From there I can use <C-z>
like I am used to doing. However, after I get back into vim, the terminal is still in Terminal-Normal mode, and I need to manually enter Terminal mode (using i
or a
or whatever).
Is there a way to send vim to the background from within a terminal window in such a way that leaves the terminal in Terminal mode? I'd like to set up some mappings such that I can treat the terminal window splits just like other vim windows seamlessly.