0

I have a redhat machine which I use remotely using putty and this is what have been bugging me a lot now...

Each time I open and close a file with any editor, my prompt shows up on the bottom line without the content of the screen being refreshed. This is really problematic because then I can't see previous outputs that were on the screen just before I opened that file which is still showing up after closing.

Is there a way to fix this. I want it to behave like the gnome-terminal. I don't think this use to happen when I was using an ubuntu server.

I understand that this is the traditional tty behavior, but I don't want it...

Thanks in advance.

L Lawliet
  • 2,565
  • 4
  • 26
  • 35

1 Answers1

0

If your terminal supports an alternate screen buffer, it should have rmcup and smcup define in its terminfo entry

% infocmp | grep -e rmcup -e smcup
    ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l,
    smcup=\E7\E[?47h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m,

If enabling altscreen in your .screenrc doesn't fix it, try adding these 2 lines to your .vimrc:

set t_ti=^[[?47h
set t_te=^[[?47l

(note that ^[ is escape, I typed ctrl-v esc)
Vim will echo ti to the terminal on startup and te on exit, instructing the shell/xterm/screen to switch screen buffers.

Joe
  • 25,000
  • 3
  • 22
  • 44
  • I don't have these defined but altscreen worked for me. So to get it working outside screen, I need to infocmp ? I can make the changes to my vimrc though. Thanks – L Lawliet Jun 13 '14 at 00:14
  • if the terminfo for your current TERM has `rmcup` and `smcup` set, Vim should echo those sequences at start and exit to switch screen buffers. If it doesn't have those defined, you can try using a different TERM, modify the terminfo for your current TERM, or add those sequences to .vimrc. – Joe Jun 13 '14 at 00:27