如果我打开一个包含 5000 行代码的文件并继续输入,我发现我的 vim 变得非常慢,大约 1s 后才显示我的输入。
在我使用--noplugin
启动后,它甚至不会变得更好。但是切换我的 .vimrc 文件后,一切又恢复正常了。 .vimrc
文件是我自己写的,检查了一段时间还是找不到错误所在。我已经清除了所有按键映射,但问题仍然存在。
那么你能给我一些建议或者告诉我如何在 vim 中调试吗?我发现有一个调试选项,但不知道如何工作。
最佳答案
启动 vim 时可以使用 --startuptime
选项:
--startuptime {fname} *--startuptime*
During startup write timing messages to the file {fname}.
This can be used to find out where time is spent while loading
your .vimrc, plugins and opening the first file.
When {fname} already exists new messages are appended.
(Only available when compiled with the |+startuptime|
feature).
采取以下步骤来诊断问题:
- 在 bash 中输入
vim --startuptime log.txt main.java
启动 vim - 在 vim 中输入
:tabe log.txt
查看日志。
关于Vim 响应相当慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9341768/