vim的GNU屏幕清理,less,等等。 出口

我很新的屏幕,但根据我在互联网上find的各种build议configuration我的〜/ .screenrc文件。 我有一个问题,虽然我相信可以很容易解决; 我认为这是一个termcap设置..?

在独立bash(Mac OSX 10.6)中使用less,vim,top或其他程序后,在退出这些程序时,terminal的缓冲区将被清除,当前命令行上面的行将成为我input的上一个命令。
但是,屏幕上,当我退出这些程序时,屏幕缓冲区将不会清除/刷新,我仍然可以看到我正在看的内部程序..有道理??

例如独立的bash(无屏幕): –

hostname:~ auser$ vim afile [do stuff in file, then :q to exit] 

退出后,我会看到: –

 hostname:~ auser$ vim afile hostname:~ auser$ 

但在屏幕上: –

 bash-3.2$ vim afile [do stuff in file, then :q to exit] 

退出后,我会看到整个屏幕: –

 ~ # [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 ] 

我希望这是有道理的。 任何和所有的帮助非常感谢! TIA

答案在于您正在使用的“真实”terminal和通过screen呈现给应用程序的terminal的terminalfunction。 通过screen执行其terminalI / O的应用程序可以查看typesscreen的terminal。 你的“真正的”terminal可能是从xtermvt100任何东西。 (使用printenv TERM或相当于找出。)

vim这样的TUI应用程序, less适合于他们的行为,无论他们发现自己正在与之交谈的terminal是否有能力。 这个答案对于terminfo机制的机制的详细阐述来说太短了,甚至对于vimless类的程序如何使用它的机制也是如此。 有这个东西的整本书。 一个非常简短的概述是,你的“真正的”terminal广告screenterminal没有的能力。

另外,当然,这已经在超级用户上得到了解答, 在这里 , 在这里和这里 。

altscreen on ~/.screenrc或者Control + a :altscreen + Return中