Use altscreen like vim with screen with Ubuntu XTerm
1
vote
0
answers
178
views
When I exit a screen, I want to be able to return to the terminal looking as I left it. But right now, all I can do is have it clear the screen and put the terminal at the top or the bottom through modifying my
.screenrc
file.
I can get the interaction I want by doing tput smcup; screen -S hello; tput rmcup
,
but I don't think I can easily alias or safely make it into a function*.
How would I change my .screenrc
file to get this behavior?
Here is what I have tried to little effect from other Stack Exchange questions:
termcapinfo xterm|xterms|xs|rxvt ti@:te@
termcapinfo xterm*|rxvt* te=\E?1049l:ti=\E[?1049h:
termcapinfo xterm*|rxvt* te=:ti=
from [How to prevent GNU screen from clearing the screen when terminating?
I also read the answer to “Why doesn't the screen clear when running vi?”
in the XTerm FAQ by Thomas E. Dickey ,
but couldn't translate it into something actionable.
Changing the term command didn't affect me and I didn't try the second part:
Detaching from a GNU Screen suddenly clears the terminal (on Super User).
\____________ \
\* I did actually try my hand at it, but I'd like some confirmation that this wouldn't break anything:
jscreen () {
if [ $# -eq 2 ]; then
if [ $1 == "-r" ] || [ $1 == "-S" ]; then
tput smcup
screen $@
tput rmcup
return
fi
fi
screen $@
}
Asked by Jeff
(121 rep)
Nov 7, 2022, 02:44 AM
Last activity: Nov 8, 2022, 04:39 AM
Last activity: Nov 8, 2022, 04:39 AM