Whack vim screen drawing errors
Asked Answered
C

3

7

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!

Cavy answered 22/8, 2011 at 18:0 Comment(2)
Have you recently changed or updated any of the programs running underneath vim? (For example, your terminal, window manager, graphics drivers, etc.?)Govea
Check that your terminal type setting is correct for the terminal emulator that you are using.Broughton
D
6

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.

Dorm answered 22/8, 2011 at 18:11 Comment(0)
B
7

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.

Brehm answered 22/8, 2011 at 18:50 Comment(1)
This was exactly the fix I needed. Thanks, fluffy.Krystlekrystyna
D
6

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.

Dorm answered 22/8, 2011 at 18:11 Comment(0)
H
2

I had a similar problem when using vim with bash. When I switched from bash to zsh, it gave redraw errors where, while I typed, the cursor or screen would appear to go down one row for every 10 characters I typed. Scrolling with arrow keys also caused major display problems along the same lines, but worse.

I had this line in my previous .vimrc, I believe it was to set the color for vim

set t_256

I changed it to set term=xterm=256color and the problem went away.

Herby answered 22/8, 2013 at 18:6 Comment(1)
I think you mean set term=xterm-256color (I changed the second = to -).Alpheus

© 2022 - 2024 — McMap. All rights reserved.