问题描述
限时送ChatGPT账号..我喜欢 Vim.但它现在让我很难过.
I love Vim. But its giving me hard times right now.
我使用了很多插件,在过去的 6 个月里,我发现了很多很棒的插件.但是我的 Vim 也变得非常缓慢.我经常清理,但没有多大帮助.
I use a lot of plugins and during the last 6 months, I've found a lot of awesome ones. But my Vim got really sluggish too. I do constant cleanups, but it doesn't help much.
我正处于 Vim 完全无法使用的地步.感觉好像是每秒 2-5 帧渲染,切换标签页/缓冲区大约需要一秒钟,用 hjkl
滚动非常糟糕,延迟太厉害了,甚至在插入模式下输入一个句子也是令人困惑(由于滞后).
I'm at the point, where Vim is completely unusable. It feels like it renders at 2-5 frames per second, switching tabs/buffers takes about a second, scrolling with hjkl
is awfully terrible, the lag is so bad, even typing a sentence in insert mode is confusing (due to lag).
实际上,当我打开 Vim 的新实例时,它是正常的,但在 15 分钟内它变得无法使用.
我刚刚花了 4 个小时试图找出导致痛苦的插件或配置.我没有成功.
I've just spent 4 hours trying to figure out which plugin or config is causing the pain. I was unsuccessful.
但是,我确实发现,删除此设置会导致所有延迟消失:语法
However, I did find out, that removal of this setting causes all the lag to go away:
syntax on
这 3 行与语法一起使一切变得更糟.
These 3 lines in conjunction with syntax make everything even worse.
set t_Co=256
set background=dark
colorscheme candyman
有趣.那么,语法高亮正在将 Vim 从超级活泼变成令人难以置信的缓慢?
Interesting. So, syntax highlighting is turning Vim from super snappy to incredibly sluggish?
我尝试在干净"模式下启用语法:vim -u NONE
I tried enabling syntax in "clean" mode:
vim -u NONE
这不是问题.
所以问题似乎是语法高亮与我的一个或多个插件的结合.我试过禁用一堆,没有运气.
So what seems to be the issue is Syntax Highlighting in combination with one or more of my plugins. I tried disabling bunch, no luck.
有没有办法进行分析?手动测试让我筋疲力尽.
Is there any way to do profiling? I'm fairly exhausted from manual testing.
有人有过类似的经历吗?也许快速浏览一下我的 .vimrc
,看看是否有任何提示.https://bitbucket/furion/dotfiles
Has anyone had similar experience? Maybe take a quick peek into my .vimrc
, see if anything rings a bell.
https://bitbucket/furion/dotfiles
解决方案:导致混乱的插件是:
Bundle "gorodinskiy/vim-coloresque.git"
我建议阅读答案,很好的见解.
I recommend reading the answers tho, good insights.
编辑(1 个月后):coloresque 插件有一些改进.
Edit (1 month later): The coloresque plugin has seen some improvements.
推荐答案
您收到了 autocmd
垃圾邮件.您应该将所有 autocmd 语句包装在组中,以便在重新添加 autocmd 之前清除该组.看起来您的 .vimrc
已注释掉大多数 autocmd,因此可能是某个插件导致了该问题.检查此命令的输出:
You have autocmd
spam. You should wrap all of your autocmd statements in groups which clear the group before re-adding the autocmds. It looks like your .vimrc
has most autocmds commented-out, so maybe there is a plugin that is causing the issue. Check the output of this command:
:au CursorMoved
如果那里有一堆重复的处理程序,那就是你的问题.
If there's a bunch of duplicate handlers there, that's your problem.
这是一个来自 我的 .vimrc 的 autocmd 规则示例
Here's an example of autocmd discipline from my .vimrc:
augroup vimrc_autocmd
autocmd!
"toggle quickfix window
autocmd BufReadPost quickfix map <buffer> <leader>qq :cclose<cr>|map <buffer> <c-p> <up>|map <buffer> <c-n> <down>
autocmd FileType unite call s:unite_settings()
" obliterate unite buffers (marks especially).
autocmd BufLeave [unite]* if "nofile" ==# &buftype | setlocal bufhidden=wipe | endif
" Jump to the last position when reopening a file
autocmd BufReadPost * if line("'"") > 1 && line("'"") <= line("$") | exe "normal! g`"" | endif
" ...etc...
augroup END
augroup
块开头的 autocmd!
在重新添加之前清除当前组(vimrc_autocmd
,在这种情况下)自动命令.
The autocmd!
at the beginning of the augroup
block clears out the current group (vimrc_autocmd
, in this case) before re-adding the autocmds.
这篇关于语法高亮导致 Vim 中的严重滞后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论