如何阻止VI重叠并隐藏命令行输出的最后一页? [英] How can I stop VI from overlapping and hiding the last page of command line output?

查看:89
本文介绍了如何阻止VI重叠并隐藏命令行输出的最后一页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,当我在屏幕上的终端窗口中启动vi时,vi程序占据了整个屏幕并覆盖了那里的任何输出历史记录,然后在退出时保留在那里.因此,稍后在我的终端输出中回滚时,vi窗口下的输出将被屏蔽.

Currently, when I start vi in a terminal window within screen, the vi program takes up the full screen and covers up any of the output history that was there, and then remains there upon exiting. Thus, when scrolling back through my terminal output at a later time, the output under the vi window is masked.

我目前正在使用bashrc中的以下别名解决此问题...

I'm currently working around this with the following alias in my bashrc...

alias vi='for i in $( seq 1 $LINES ); do echo ; done ; vi'

到目前为止,这种方法效果还不错,但是让我感到有些困惑,我担心我会遇到无法预料的情况,这会使我在某个时候失败.我想知道是否有用于vi或屏幕的命令选项,或者是否有其他更简单,更有效的方法来实现相同的目的.

This has worked just fine so far, but it strikes me as kind of kludgy and I fear I'm going to hit an unforeseen situation where it fails me at some point. I was wondering if there's a command option for either vi or screen or some other simpler, more efficient way of achieving the same.

谢谢.

推荐答案

如果使用GNU Screen,则.screenrc中的以下行应解决该问题:

If you use GNU Screen, the following line in your .screenrc should solve the problem:

altscreen on

这将确保退出Vi后恢复旧内容,并且不会再使滚动历史变得混乱.

This will ensure that the old contents is restored after you exit Vi, and it won't clutter your scrollback history anymore.

这篇关于如何阻止VI重叠并隐藏命令行输出的最后一页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆