哪个默认设置会使 Vim 在 Mac 屏幕上变得非常慢?

发布于 2024-07-21 07:13:07 字数 2378 浏览 0 评论 0原文

虽然我接受了一个答案,但问题并没有解决。

问题: Vim 在 Mac 的 Screen 中更新屏幕的速度非常慢,尽管 lazyredraw 和 showcmd 已关闭


行号出现在 FoldColumn 上,如下所示,例如,当我有行号时 替代文本 http://dl.getdropbox.com/u/175564/vimScreenFold.png< /a>

当我的 .vimrc 中没有任何内容时,可以通过相互叠加的多个注释行来看出问题: 替代文本 http://dl.getdropbox.com/u/175564/vimScatteredBug.png< /a>

我没有在左侧多次输入以下评论

"set list...

观察

  1. 似乎只发生在注释行和空行。 但是,我得到了证据(2) 这表明事实并非如此。
  2. 散射主要发生在左侧窗口中。 它们也发生在单个窗口中。 然而,用它来检测更困难。
  3. 当我的 .vimrc 中没有任何内容时,该错误的发生情况略有不同。 然而,“停滞”发生在两种情况下:空 .vimrc 和非空 .vimrc。

Bug 识别

因变量

  1. 依赖于 Vim 自动放置的注释符号。 当 Vim 无法显示整个文件时,我注意到当 Vim 自动将 Python 的注释符号 # 添加到我的文件中时,像素消失了。
  2. 依赖至少 OS/X Leopard。

自变量

  1. 文件独立:出现在 Vim 编辑的所有文件中
  2. 行独立:发生在没有注释和空行的Python代码中
  3. .vimrc独立:发生与空 .vimrc
  4. .screenrc 独立:与空 .screenrc
  5. shell 独立一起发生:与 Bash 和 Zsh 一起发生
  6. 屏幕版本无关:发生在 Leopard 的默认屏幕和 Screen 4.0.3
  7. < strong>独立于不同的注释字符:向下滚动时发生,例如 .zshrc、.vimrc 和 .screenrc

如何禁用 Vim 的 默认设置

The problem is not solved although I accepted one answer.

Problem: Vim updates very slowly the screen in Screen in Mac, although lazyredraw and showcmd are off.


The line numbers get on the foldColumn as below, for instance, when I have line numbers
alt text http://dl.getdropbox.com/u/175564/vimScreenFold.png

When I have nothing in my .vimrc, the problem can be seen by multiplied comment lines on top of one another:
alt text http://dl.getdropbox.com/u/175564/vimScatteredBug.png

I did not type the following comment more than once on the left-hand side

"set list...

Observations

  1. seemed to occur only in comment lines and empty lines. However, I got the evidence (2) which shows that this is not the case.
  2. scatters occurs mostly in the left-hand-side window. They occur also with a single window. However, it is harder to detect with it.
  3. The bug occurs slightly differently when I have nothing in .vimrc. However, the "stagnation" occurs in both situations: with empty .vimrc and with non-empty .vimrc.

Identification of Bug

Dependent variables

  1. dependent on comment signs automatically put by Vim. I noticed disappeared pixels when Vim put Python's comment signs # automatically to my files, when it could not show the whole file.
  2. dependent on at least OS/X Leopard.

Independent variables

  1. file independent: occurs in all files edited by Vim
  2. line independent: occurs in a Python code without comments and empty lines
  3. .vimrc independent: occurs with empty .vimrc
  4. .screenrc independent: occurs with empty .screenrc
  5. shell independent: occurs with Bash and Zsh
  6. Screen version independent: occurs with Leopard's default screen and with Screen 4.0.3
  7. independent of different comment characters: occurs when scrolling down, for instance, .zshrc, .vimrc and .screenrc

How can you disable Vim's default settings?

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

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

发布评论

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

评论(8

究竟谁懂我的在乎 2024-07-28 07:13:07

我猜测问题可能出在您的 termcap 和 terminfo 设置上。 尝试从 screenrc 中注释掉这些内容,然后重新启动 screen。

另外,您使用的是什么(非虚拟)终端?

啊,看起来你正在使用 OSX 的 Terminal.app,它是正是我使用的(使用 screen/zsh/vim)。 /usr/bin/screen 应该与带有空 .screenrc.vimrc/usr/bin/vim 一起使用> 默认情况下。

% touch empty_screenrc
% cat empty_screerc
% /usr/bin/screen -c empty_screenrc
#...and within screen
% /usr/bin/vim -u NONE

如果问题仍然存在,则问题可能出在您的 shell 中。 但如果这解决了问题,我建议发布您的 ~/.vimrc 以帮助进一步诊断。

I'm guessing that the issue might be with your termcap and terminfo settings. Try commenting those out from your screenrc, and restarting screen.

Also, what (non-virtual) terminal are you using?

Ah, it looks like you're using OSX's Terminal.app, which is exactly what I use (with screen/zsh/vim). /usr/bin/screen should work with /usr/bin/vim with an empty .screenrc and .vimrc by default.

% touch empty_screenrc
% cat empty_screerc
% /usr/bin/screen -c empty_screenrc
#...and within screen
% /usr/bin/vim -u NONE

If the problem still persists, the problem may be in your shell. But if this fixes the problem, I'd suggest posting your ~/.vimrc to aid in further diagnosis.

情归归情 2024-07-28 07:13:07

我认为 OS X 默认版本的屏幕不支持 256 色。 您可以将 vim 设置为在 .vimrc 文件中使用较少数量的颜色:

set t_Co=16

在 Mac OS X 上,您可以重建屏幕以使用 256 种颜色,请参见此处:http://pjkh.com/articles/2008/07/09/osx-iterm-screen-vim-256-colors

以下是简短版本的说明:

重建屏幕,确保包含 256 色选项:

./configure --enable-colors256

然后您需要将以下内容添加到 ~/.screenrc:

# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"

来源

I think that the OS X default version of screen does not support 256 colors. You can set vim to use a lower number of colors in your .vimrc file:

set t_Co=16

On Mac OS X you can rebuild screen to use 256 colors, see here: http://pjkh.com/articles/2008/07/09/osx-iterm-screen-vim-256-colors.

Here's the short version of the instructions:

Rebuild screen making sure to include the 256 colors option:

./configure --enable-colors256

Then you will need to add the following to your ~/.screenrc:

# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"

Source

若有似无的小暗淡 2024-07-28 07:13:07

我没有插件,.vimrc 和 .screenrc 中也没有任何内容。
问题仍然存在。

bug 识别

  1. 文件无关:发生在 Vim 编辑的所有文件中

“停滞”似乎主要发生在注释行和空行中。
然而,该错误也出现在没有注释和空行的情况下,但其影响似乎要小得多。

观察图片2
替代文本 http://dl.getdropbox.com/u/175564/cruxMoveInVimScattered.png< /a>

I have no plugins and nothing in in .vimrc and .screenrc.
The problem still persists.

Identification of bug

  1. file independent: occurs in all files edited by Vim

The "stagnation" seems to occurs mostly in comment lines and empty lines.
However, the bug occurs also without comments and empty lines, but the impact of it seems to much smaller.

Picture for the observation 2
alt text http://dl.getdropbox.com/u/175564/cruxMoveInVimScattered.png

街道布景 2024-07-28 07:13:07

我遇到了这个问题(速度慢得令人痛苦),它最终成为我在 Terminal.App 和 ITerm 中使用的 Consolas 字体。 就我而言,切换到摩纳哥大大加快了速度。

I had this problem (just painfully slow) and it ended up being the Consolas font I was using in Terminal.App and ITerm. In my case switching to the Monaco sped things up considerably.

丑丑阿 2024-07-28 07:13:07

症结:该错误似乎是因为 Vim 的某些默认选项导致问题而发生的,

我现在在 .vimrc 和 .screenrc 中使用默认配置,因为我观察到它们不会导致该错误。

该错误似乎稍微依赖于注释和空行
我有证据证明这一点。

我的 Python 代码中没有注释,也没有空行。 然而,我注意到,当 Vim 无法显示整行时,它会在我的代码中添加注释标记。 例如,注意 Vim 放在那里的三个 # 标记。

这导致了像素消失。

替代文本 http://dl.getdropbox.com/u/175564/pythonBug.png< /a>


当我看不到 Vim 自动放置的注释符号时,该错误似乎发生在同一个文件中。

替代文本 http://dl.getdropbox.com/u/175564/counterExample.png< /a>

我故意复制了图片的代码,以便您可以清楚地看到消失的像素。

有一次我在玩 Python 代码时注意到,在代码中添加一个空行后,“停滞”发生了很大。 但是,我还没有成功复制该事件。


尝试通过 .vimrc 解决 bug 失败

  1. 禁用 Vim 自动设置的注释符号

    set formatoptions-=c

Crux move: the bug seems to occur because some of Vim's default options cause the problem

I use my default configs in .vimrc and .screenrc now, since I observed that they do not cause the bug.

The bug seems to be slighly comment and empty line dependent.
I got an evidence of it.

I have no comments and no empty lines in my Python code. However, I noticed that when Vim cannot show full lines, it puts comment marks to my code. For example, notiche the three # -marks, which Vim put there.

This caused the disappeared pixel.

alt text http://dl.getdropbox.com/u/175564/pythonBug.png


The bug seems to occur in the same file when I cannot see the comment signs automatically put by Vim.

alt text http://dl.getdropbox.com/u/175564/counterExample.png

I duplicated by purpose the code for the picture such that you can see the disappered pixels clearly.

I noticed once when I was playing with the Python code that the "stagnation" occurred greatly after I put a single empty line to the code. However, I have not managed to duplicate the event.


Unsuccessful Attempts to solve the bug by .vimrc

  1. to disable comments signs set automatically by Vim

    set formatoptions-=c

尬尬 2024-07-28 07:13:07

似乎存在一些与 OS X 换行模式相关的已知问题,请参阅第 1 点。此处< /a>. 它提出了一种解决方法。

It looks like there are some known issues relating to wrap mode for OS X, see number 1. here. It suggests a workaround.

萧瑟寒风 2024-07-28 07:13:07

我在 irssi 和 bash 上也遇到过类似的问题,这是由颜色代码未正确关闭引起的。

您是否尝试过不同的 vim 主题(特别是默认主题),或运行 :syntax off

I've had similar problems with irssi and bash, which were caused by colour codes not closed correctly..

Have you tried a different vim theme (specifically the default one), or running :syntax off ?

似梦非梦 2024-07-28 07:13:07

调试:

有人建议我冻结我的终端以防止其他应用程序的更改,

ttyctl -f

但是,它似乎并没有解决问题。
尽管如此,它可能会帮助我们找到错误,因为我们现在没有其他应用程序改变这种情况。

Debugging:

One suggested me to freeze my terminal from the changes of other applications by

ttyctl -f

However, it did not seem to solve the problem.
Nevertheless, it may help us to find the bug, since we do not have other apps changing the situation now.

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