Ama*_*mar 3 terminal-emulator terminal vi
请参阅下面的示例以了解我的问题;考虑我的控制台提示看起来像这样
user@server $ ls
"I opened a file temp"
user@server $ vi temp
Run Code Online (Sandbox Code Playgroud)
temp 将在同一窗口中打开,当我关闭 temp 时,我不会回到:
user@server $ ls
user@server $ vi temp
user@server $
Run Code Online (Sandbox Code Playgroud)
相反,我会回到这样的事情上
user@server $ ls
user@server $ vi temp
"temp file content"
"temp file content"
"temp file content"
user@server $
Run Code Online (Sandbox Code Playgroud)
它占用了我的可见屏幕空间,我最终可能会因为这个文件内容而丢失一些重要的输出。
终端中有一个称为“交替屏幕”的功能。它允许程序使用不同的虚拟“屏幕”并在退出时恢复前一个。
您需要一个支持此功能的终端模拟器。Gnome-terminal、urxvt 和 xterm 都可以。我从未见过它在默认情况下被禁用,但如果它只是被禁用,您可以使用 Xresources 启用它。如果您有 xterm 或 urxvt,则在您的~/.Xresources
或~/.Xdefaults
文件中,添加以下内容:
对于 xterm:
XTerm*titeInhibit: false
Run Code Online (Sandbox Code Playgroud)
对于 urxvt:
urxvt*secondaryScreen: true
Run Code Online (Sandbox Code Playgroud)
一些 gui 终端可能有一个带有复选框的选项面板,用于启用备用屏幕。
更多资源:
http://blogmal.42.org/tidbits/titeinhibit.story
http://shallowsky.com/linux/noaltscreen.html