vim、less 等上的 GNU 屏幕清除。出口

Ale*_*ach 7 bash gnu-screen

我对 screen 很陌生,但已经根据我在互联网上找到的各种建议配置了我的 ~/.screenrc 文件。我有一个问题,但我确信可以很容易地解决它;我认为这是一个termcap设置..?

在独立 bash(在 Mac OSX 10.6 上)中使用 less、vim、top 或其他程序后,退出这些程序时,终端的缓冲区将清除,当前命令行上方的行将是我输入的上一个命令。
但是,对于屏幕,当我退出这些程序中的任何一个时,屏幕缓冲区不会清除/刷新,我仍然会看到我在该程序中看到的内容..有意义吗??

例如在独立的 bash(没有屏幕)中:-

hostname:~ auser$ vim afile 
[do stuff in file, then :q to exit]
Run Code Online (Sandbox Code Playgroud)

退出后我会看到:-

hostname:~ auser$ vim afile 
hostname:~ auser$
Run Code Online (Sandbox Code Playgroud)

但在屏幕上:-

bash-3.2$ vim afile
[do stuff in file, then :q to exit]
Run Code Online (Sandbox Code Playgroud)

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

~  # [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 ]
Run Code Online (Sandbox Code Playgroud)

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

Jde*_*eBP 6

答案在于您正在使用的“真实”终端和通过screen. 应用程序通过screen查看类型为 的终端来执行其终端 I/O screen。您的“真实”终端可以是从xterm到 的任何内容vt100。(使用printenv TERM或等效来找出。)

TUI 应用程序喜欢vimless根据他们发现自己与之交谈的终端的能力调整他们的行为。这个答案对于详细阐述terminfo机制的机制来说太短了,甚至对于程序如何喜欢vimless使用它的机制来说都太短了。有关于这些东西的整本书。一个非常简短的概要是,您的“真实”终端正在宣传该screen终端没有的功能。

另外,当然,这已经在 SuperUser 上得到了详细的回答,这里这里这里


小智 6

altscreen on~/.screenrcControl+ a:altscreen+Return