开发者

Whack vim screen drawing errors

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 t开发者_如何转开发o 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!


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜