Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Apr 11 '12 at 9:47

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 3 down vote accepted
:redraw

can be used to redraw everything.

share|improve this answer
    
Thanks, but I certainly do not want to reload the file! –  dotancohen Apr 10 '12 at 19:20
1  
Did you by any change try :redraw? –  Bernhard Apr 10 '12 at 19:22
    
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 Apr 10 '12 at 20:11
    
Of course, even I didn't know the answer was so obvious ;) –  Bernhard Apr 10 '12 at 20:24
    
Thank you Bernhard! –  dotancohen Apr 10 '12 at 20:50

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.

share|improve this answer
    
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 Apr 11 '12 at 1:11
    
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 Apr 11 '12 at 4:55
    
$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 Apr 11 '12 at 14:09

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.