I find it annoying to constantly press
Ctrl-Z and then
fg to go between these screens (where command terminal is the command line that you used to invoke
vim from). It also generates unwanted
fg lines on my console. I'm pretty sure this can be done as I remember doing it when I was in university, but I can't remember how.
Information on Terminals and its Relation to vim
vt100 terminal and others have a way to save the screen prior to changing it and then it could restore it when it wants to.
vim does this and can be seen if you go into
vim and then shell or
Ctrl-Z out. Most of the time it will show you what you had on the screen prior to entering
vim by saving the screen prior to painting the
vim screen. If your terminal doesn't support this functionality, it will just put the command line directly under the
vim screen, scrolling it up. This can be seen by exporting to the TERM variable a less functional terminal emulation or clearing it (though by clearing it, it may put
vim into line mode or may use the most basic of terminal codes depending on its implementation). To see more on saving/restoring a screen, see Terminal codes (ANSI/VT100) introduction, under the heading Save/restore screen.