When using vim or less in gnu screen, quitting vim or less leaves a lingering imprint When using vim or less in gnu screen, quitting vim or less leaves a lingering imprint unix unix

When using vim or less in gnu screen, quitting vim or less leaves a lingering imprint


screen's altscreen (alternate screen) feature is turned off by default.

Add this to your .screenrc:

altscreen on

See: http://www.gnu.org/software/screen/manual/screen.html#Redisplay


This is caused by your termcap for screen being incomplete. (This seems to be a really common problem.) Vim doesn't know the sequence for restoring the screen, so it just leaves it like it was.

You can work around this problem by setting vim's term option (or the TERM environment variable before you start vim) to a terminal that's "screen compatible", like xterm. eg:

TERM=xterm vim

or (in vim):

:set term=xterm

You can set the t_ti and t_te options in vim to the right codes. See :help xterm-screens in vim for more details.