每当我切换到 VIM 时都会刷新缓冲区
我使用 VIM 通过 SCP 编辑文件,因此读取和写入文件是一个非常缓慢的过程。
由于某种原因,每当我切换到缓冲区时,VIM 都会从磁盘读取它。状态栏显示:~@k。
我已经禁用了 .vimrc 中的所有自动命令,并且无论如何我都没有 BufEnter 的自动命令。知道我可能会错过什么吗?
更新:我发现了一个罪魁祸首,一个不是自动命令的字数统计宏。现在,当我切换时,速度会快一点,但仍然很慢。状态栏显示 ^Ww。
更新2:我尝试了下面ZyX的答案(谢谢!!)。结果:
1)设置eventignore=all绝对解决;它的速度非常快。但 2)尝试调试它对我来说不起作用。
我尝试了 :debug buffer scp-buffer-name
和 :debug wincmd p
并得到:
进入调试模式。输入“cont”继续。
cmd:wincmd p
第 1 行:for m in filter(copy(fuf#getModeNames()), 'fuf#{v:val}#requiresOnCommandPre()')`
然后无论我输入什么 (s, n, "cont "),那一行只会重复。它显然与 Fuzzy Finder 插件相关,我经常使用该插件,也是我使用 VIM 的一个关键原因。有什么想法吗?
再次感谢您的帮助。非常感谢,XyZ!
问题已解决:这确实是模糊查找器。它具有 MRU 文件模式,文档指出在切换缓冲区时可能会导致性能问题。我禁用了这个模式,现在 VIM 又快了!谢谢!
I'm using VIM to edit files over SCP, so reading and writing files is a very slow process.
For some reason, whenever I switch to a buffer, VIM reads it from disk. The status bar says: ~@k.
I've disabled all autocommands in my .vimrc, and I have no autocommands for BufEnter anyway. Any idea what I might be missing?
Update: I found one culprit, a word-count macro which wasn't an auto-command. Now when I switch it's a tad faster but still slow. Status bar says ^Ww.
Update 2: I tried ZyX's answer below (Thanks!!). The results:
1) setting eventignore=all absolutely solves it; it's blazing fast. BUT
2) trying to debug it doesn't work for me.
I tried both :debug buffer scp-buffer-name
and :debug wincmd p
and got:
Entering Debug mode. Type "cont" to continue.
cmd: wincmd p
line 1: for m in filter(copy(fuf#getModeNames()), 'fuf#{v:val}#requiresOnCommandPre()')`
And then no matter what I typed (s, n, "cont"), that single line would just repeat. It's obviously related to the Fuzzy Finder plugin, which I do use quite a lot and is a key reason for me to use VIM. Any ideas?
Thanks again for your help. Much appreciated, XyZ!
ISSUE SOLVED: It was indeed Fuzzy Finder. It has a MRU-File mode which documentation notes may cause a performance issue when switching buffers. I disabled this mode and now VIM is fast again! Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,使用
set eventignore=all
测试此行为。如果问题得到解决,请尝试使用(确保已取消设置 eventignore)debug buffer scp-buffer-name
或debug wincmd p
切换到 scp 缓冲区(具体取决于何时你看到问题了),它将打开调试模式,你将能够看到它正在执行的所有自动命令(使用s[tep]
或n[ext]
移动到下一个命令,请参阅:h >next
和:h >step
了解更多详细信息)。First, test this behavior with
set eventignore=all
. If the problem gets fixed, try to switch to scp buffer using (be sure you have unset eventignore)debug buffer scp-buffer-name
ordebug wincmd p
(depending on when you see the problem), it will open debug mode and you will be able to see all autocommands it is executing (uses[tep]
orn[ext]
to move to next command, see:h >next
and:h >step
for more details).