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.
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'
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.
Thanks.
If you use GNU Screen, the following line in your .screenrc should solve the problem:
altscreen on
This will ensure that the old contents is restored after you exit Vi, and it won't clutter your scrollback history anymore.
Try adding set t_ti= t_te=
to your .vimrc file.
To fix less which also exhibits this behavior, set export LESS=-X
in your .bashrc file.
Note: Some terminals such as urxvt are able to fix this globally for all ncurses program with a settings like this: urxvt*secondaryScreen: false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With