vim分屏中滚动非常缓慢

11

当我在vim中使用j, k或鼠标滚轮进行滚动时,它非常敏感和快速,但是一旦我在分屏中打开一个新缓冲区,滚动就会变得非常缓慢/延迟。这主要发生在非常大的文件(1000+行)中,即使第二个缓冲区在分屏中为空也是如此。

我尝试了不同的终端并重现了这个问题。我还尝试使用ttyfastlazyredraw,但它们都没有改变任何事情。

如果我使用-u NONE启动vim,情况是一样的,只是不那么明显。

在滚动和重新绘制屏幕方面,在使用和不使用分屏模式下vim有什么大的区别呢?

编辑:

我刚刚意识到问题只出现在垂直分屏中。水平分屏正常工作!

编辑2:

该行为仅出现在vi / vim的终端版本中。一旦我像vim一样使用相同的配置启动gVim,一切都像魔法般顺利,即使在垂直拆分中也是如此。我在另一个论坛上发现了一个类似问题的人。他得到了关于问题可能是什么的答案,但没有得到如何解决它的方法。答案是:

That's because the application has to repaint the screen rather than actually
scrolling (since it cannot rely on the left/right halves of the display
to scroll at the same rate).

编辑3:

我正在运行 Ubuntu 13.10 - 64位。

我的电脑配置如下:

  • Intel Core i7-4770K
  • GeForce GTX 760(专有驱动程序nvidia-319)
  • 16 GB内存

这里是vim --version的输出结果。

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 12 2013 00:23:33)
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    
+farsi           +mouse_netterm   +syntax      

4
<kbd></kbd>是HTML标记,用于指示文本应该被呈现为键盘键或其他用户输入设备上的按键。 - brandonscript
新缓冲区是否足够大?选项卡是否以相同的方式运作? - exussum
只需点击编辑按钮即可... - Karoly Horvath
@user1281385,旧缓冲区是一个大文件,新缓冲区可以是NerdTree或TagBar等。这实际上是我的问题。因为我喜欢在编写代码时打开TagBar,但由于延迟非常烦人。一旦我关闭TagBar,一切都好了。选项卡不会表现出这种行为。 - Johnny Mudcrab
1
你尝试过 :syntax off 吗?我记得几年前我遇到了一个缓慢滚动的问题,主要是由于语法高亮引起的。 - Dan Lowe
显示剩余12条评论
2个回答

1
实际上您已经回答了原始问题:

That's because the application has to repaint
the screen rather than actually scrolling

当页面滚动速度较慢时,我会尝试使用22j代替j,其中22可以是任何数字,这样可以让vim进行移动而不是计算每个j的滚动。


1
自原问题已得到解答,我想补充我的解决方案,这对我来说似乎可以在运行Vim 7.4.52和Ubuntu 14.04时工作。我使用tmux来垂直分割终端窗口并在每个模拟终端中运行独立的vim实例。再加上vim-tmux-navigator,它允许在vim和tmux之间无缝导航,体验基本相同,但滚动时没有卡顿。唯一遗漏的是从一个缓冲区复制/粘贴到另一个缓冲区的能力,但这肯定也是可以解决的。

我已经尝试过这个,但是在使用垂直 tmux 分割而不是垂直 vim 分割时仍然很慢。 - Y. Gherbi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接