Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm working on a Ubuntu Linux machine and I'm looking for a way to get the xterm to scroll when things are cleared rather than clearing the screen and showing the previous contents.

This may not make sense so a couple examples might. When I run vim in an xterm and hit ctrl-Z it wipes the screen and shows me the command prompt that I used to run the command. Instead I'd like to still be able to see what I was editing. Or when reading a man page I find the part I was looking for so I hit q to drop out and the screen clears and shows the command I used to launch that, but the information I wanted from the man page is gone.

I found that setting the TERM environment variable to vt100 gets me the scrollback that I want but doing that has drawbacks such as disabling colors and key actions in editors that look at TERM. For example in vim colors don't work and Page Down key no longer pages.

Is there a way to get both the scrollback and the features of TERM=xterm?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This command will turn the effect on for any XTerms started later:

echo XTerm*VT100.TiteInhibit: True|xrdb -merge

From xterm(1):

titeInhibit (class TiteInhibit)

Specifies whether or not xterm should remove ti and te termcap entries (used to switch between alternate screens on startup of many screen-oriented programs) from the TERMCAP string. If set, xterm also ignores the escape sequence to switch to the alternate screen. Xterm supports terminfo in a different way, supporting composite control sequences (also known as private modes) 1047, 1048 and 1049 which have the same effect as the original 47 control sequence. The default for this resource is “false.”

Put the line XTerm*VT100.TiteInhibit: True in your ~/.Xresources file if you want the effect to be permanent.

share|improve this answer
    
This works perfectly. Now I just have to figure out how to set this type of thing for every type of terminal. Thanks –  Ed. Nov 13 '09 at 22:39
    
@Ed: You could always ask here... –  Teddy Nov 14 '09 at 21:52
    
Your comments gave me enough information to search for the solution. Here's what I came up with infocmp > xterm.src edit xterm.src and remove rmcup and smcup entries tic xterm.src cp xterm ~/.terminfo/x/xterm –  Ed. Nov 16 '09 at 15:48

One thing you can do if you use less (also if it's the pager you're using for man) is to set LESS=X (plus whatever other defaults you have) in your ~/.bashrc file. This will cause less to leave what it was displaying on the screen when you exit.

share|improve this answer
    
man is using less as its pager on my system so this worked quite well for those things. It unfortunately didn't work for other things such as vim. –  Ed. Nov 13 '09 at 22:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.