I know I can :!
or :r!
to execute external command and optionally insert its output into text. I can even perform :!sh
and I'll spawn a shell that will live until I exit it - but while the shell is active, Vim is 'asleep' and inaccessible. I must quit the shell, and spawn a new one if I want to return to Vim for a moment - not very useful.
I can access shell on the opposite end, by suspending Vim with ^Z and manage the Vim job through bg
, fg
and jobs
. This makes more sense but is very cumbersome in the long run. I can use Screen
if it's available (it often isn't), or open several windows of my window manager (and ssh to target host from each of them in sequence, to have both vim and shell on the remote host, cumbersome again.)
It would be neatest if Vim allowed me to open a shell session and keep it, say, in one of its (internal) windows, or allow me to switch to it and back. Is something like this possible?
:split
, while retaining the file in the other window? ... This sounds like a job for tmux or screen to me ...:terminal
command