Putty: Refresh VIM screen

3

Often when working in VIM via SSH in Putty from a Windows machine I get line corruption, where the display is one line off. Running :!clear or unmaximizing-then-maximizing the Putty window resolves the issue, but ^L and ^R do not. Is there a better way from within VIM to redraw the screen?

Thanks.

dotancohen

Posted 2012-04-10T19:01:01.223

Reputation: 9 798

Answers

3

:redraw

can be used to redraw everything.

Bernhard

Posted 2012-04-10T19:01:01.223

Reputation: 1 017

Thanks, but I certainly do not want to reload the file! – dotancohen – 2012-04-10T19:20:15.327

1Did you by any change try :redraw? – Bernhard – 2012-04-10T19:22:56.200

Thanks, that does seem to be the right answer! Can you edit the answer to :redraw so that I can accept it as the right answer? Thanks! – dotancohen – 2012-04-10T20:11:23.697

Of course, even I didn't know the answer was so obvious ;) – Bernhard – 2012-04-10T20:24:20.463

8

Ctrl-L redraws everything.

I'm doing it now in Putty and can see it happening.

The response is very fast to the host I'm connecting to, but if I press Ctrl-L enough times, I can catch a glimpse of the screen at various stages of a complete top-to-bottom redraw.

You're working around some weird problem.

Firstly, why would your session be corrupted over SSH? Putty-serial, maybe ... (I use that!)

One line off suggests that maybe the operating system on the other side has the wrong idea about the size of your terminal. If an application thinks that your terminal is larger than it really is, it will end up writing a character to the bottom right corner, causing a scroll.

Also check the value of $TERM: what terminal type are you giving to Vim? A terminal type mismatch will also cause this kind of thing.

Kaz

Posted 2012-04-10T19:01:01.223

Reputation: 2 277

I've been using Vim since 1994 and I haven't ever had to resort to :redraw. I used it on Amber-screen WYSE terminals with their "native" WYSE-50 terminal control language, a real DEC VT100, various OS consoles and emulators... – Kaz – 2012-04-11T01:11:44.030

Agreed; CTRL-L is the "usual" way to do screen refresh throughout the Unix-derived world, not just vim. The help for :redraw hints that it's intended more to help long-running scripts avoid the appearance of locking up than to fix terminal display issues. – David Pope – 2012-04-11T04:55:13.527

$TERM is set to xterm. The problem is indeterminate and I cannot reproduce it at will. I have since discovered that :redraw does not solve the issue either. Should I set $TERM to putty? I often log in on my home Kubuntu machine in Konsole, which does not have this issue. – dotancohen – 2012-04-11T14:09:35.353