I'm very new to screen but have configured my ~/.screenrc file according to various recommendations I've found on the internet. I have one issue with it though which I'm sure could be resolved very easily; I think it's a termcap setting..?
After using less, vim, top, or other programs in standalone bash (on Mac OSX 10.6), upon exiting these programs, the terminal's buffer will clear and the line above the current command line will be the previous command I entered.
However, with screen, when I exit any of these programs, the screen buffer won't clear / refresh and I'll still see what I was looking at inside that program.. Make sense??
e.g. in standalone bash (without screen):-
hostname:~ auser$ vim afile
[do stuff in file, then :q to exit]
After exiting I'll see:-
hostname:~ auser$ vim afile
hostname:~ auser$
But in screen:-
bash-3.2$ vim afile
[do stuff in file, then :q to exit]
After exiting I'll see a whole screen of:-
~ # [Empty lines in vim are represented by these tilda characters. ]
...
~ # [ Every line on the screen is one of these tildas ]
bash-3.2$ # [ This is the bottom line in the terminal ]
I hope that makes some sort of sense. Any & all help much appreciated! TIA
The answer lies in the terminal capabilities of both the "real" terminal that you are using and the terminal that is presented to applications via
screen
. Applications performing their terminal I/O viascreen
see a terminal of typescreen
. Your "real" terminal could be anything fromxterm
tovt100
. (Useprintenv TERM
or equivalent to find out.)TUI applcations like
vim
andless
tailor their behaviour to whatever the terminal that they find themselves talking to is capable of. This answer is far too short for a detailed exposition of the mechanics of the terminfo mechanism, or even for the mechanics of how programs likevim
andless
make use of it. There are whole books on this stuff. A very brief précis is that your "real" terminal is advertising a capability that thescreen
terminal is not.Plus, of course, this has already been answered on SuperUser at length, here and here and here.
put
altscreen on
in~/.screenrc
or Control+a:altscreen
+Return