修复 vim 屏幕绘图错误

发布于 2024-11-30 14:28:22 字数 362 浏览 1 评论 0原文

当我在 vim 中打开文件时,发生了一些非常奇怪的事情,而且我不记得做了什么会导致它的事情。

奇怪的行为包括:

  • 在我在视觉模式下突出显示文本之前,没有任何文本可见,此时它从那里可见。 “:重画!”不会使任何东西可见。
  • 第 1 行偶尔丢失
  • 光标​​出现在编辑
  • 状态的下方一行 状态变为永久并从底部向上滚动,而不是仅仅在底部重绘
  • vim 文本没有延伸到垂直最大化窗口的底部

我缺乏发布的声誉屏幕截图,但我很乐意提供任何其他有助于诊断的信息。

预计到达时间:啊!我的 .vimrc 指定了列/行大小。我已经删除了那条线,到目前为止一切都表现良好。谢谢你!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

美羊羊 2024-12-07 14:28:22

如果您是在 UNIX(Linux 等)上执行此操作,请尝试运行 :!resize 来强制您的终端重新调整其大小参数。至少它会告诉您系统认为您的窗口大小是多少,这可能与其实际大小不匹配。

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.

你的心境我的脸 2024-12-07 14:28:22

vim 是基于终端的,当您使用的终端与 vim 认为您正在使用的终端不匹配时,就会发生类似的错误。大多数人将 vim 与终端模拟器一起使用。当您调整模拟器窗口大小而 vim 没有发现这种情况时,或者更罕见的是,当环境中指定的终端标识字符串与您正在运行的终端模拟器不匹配时,就会发生这种情况。

如果没有关于运行 vim 的平台的更多详细信息,很难更具体——但作为提示:在创建模拟器窗口之后但运行 vim 之前,不要调整模拟器窗口的大小。

终端模拟器应该将大小更改传达回其中运行的程序,但这并不是 100% 万无一失,尤其是当您登录到模拟器内的远程计算机时。

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.

作妖 2024-12-07 14:28:22

我在使用 vim 和 bash 时遇到了类似的问题。当我从 bash 切换到 zsh 时,它出现了重画错误,在我键入时,光标或屏幕似乎每键入 10 个字符就会向下移动一行。使用箭头键滚动也会导致同样的主要显示问题,但更糟。

我之前的 .vimrc 中有这一行,我相信它是为了设置 vim 的颜色,

set t_256

我将其更改为 set term=xterm=256color 然后问题就消失了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文