Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whack vim screen drawing errors

Tags:

vim

screen

redraw

Something extremely weird is happening when I open files in vim, and I can't remember doing anything that would have caused it.

Weird behaviors include:

  • no text being visible until I highlight it in visual mode, at which point it is visible from thereon. ":redraw!" does not make anything visible.
  • line 1 missing
  • occasionally the cursor appears one line below where it is editing
  • statuses become permanent and scroll up from the bottom, rather than just redrawing at the bottom
  • the vim text not extending to the bottom of the vertically maximized window

I lack the reputation to post screenshots but I'll happily provide any other information that could help in a diagnosis.

ETA: Ah! My .vimrc specified a column/row size. I've removed that line, and so far things are behaving well. Thank you!

like image 953
tom Avatar asked Aug 22 '11 18:08

tom


2 Answers

vim is terminal based, and errors like this happen when the terminal you are using does not match the terminal vim thinks you are using. Most people use vim with terminal emulators. This kind of thing can happen when you resize the emulator window and vim does not find out about it, or more rarely, when the terminal-identifying-string specified in the environment does not match the terminal emulator you are running.

Without more details about the platform on which you are running vim, it is hard to be more specific-- but as a tip: don't resize the emulator window after it is created but before running vim.

Terminal emulators are supposed to communicate size changes back to the program running within them, but this is not 100% foolproof, especially when you are logged in to a remote machine within the emulator.

like image 60
antlersoft Avatar answered Oct 21 '22 21:10

antlersoft


If you're doing this from a UNIX (Linux et al), try running :!resize to force your terminal to re-adjust its size parameters. At the very least it'll tell you what the system thinks your window is sized to, which may not match its actual size.

like image 22
fluffy Avatar answered Oct 21 '22 21:10

fluffy