I know that, while in Vim (and Vi, too, I think), if I want to temporarily access the shell I can do one of several things:
- Use
:sh
(a.k.a.:shell
), then log out from the shell to return to Vim - Use
:sus
(a.k.a.:suspend
,:st
, or:stop
), then usefg
to return to Vim - Use
:! <command>
to pass commands through Vim to the shell - Use
:mksession <filename>
to save a session, quit Vim, then restore the session with:source <filename>
after returning to Vim (admittedly this is probably too cumbersome for most "temporary" shell access needs) - Use windowing software such as screen, tmux, etc.
My question is, what are the technical and practical differences of the first two options—using :sh
vs. using :sus
? In the Vim help pages, it looks like the only difference is that with :sus
, you either automatically write out the buffer (if 'autowrite' is set) or you risk losing your edited buffers if you never return to Vim, whereas with :sh
you have no choice but to return to your Vim session when you exit the shell.
Are there any other differences, either technically (such as memory and processor use) or productivity-related reasons why a Vim user might choose one method over the other in different situations?