Syntax highlighting causes terrible lag in Vim

前端 未结 10 1518
孤独总比滥情好
孤独总比滥情好 2020-12-12 11:20

I love Vim. But its giving me hard times right now.

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 slu

10条回答
  •  离开以前
    2020-12-12 11:57

    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.

    Here's an example of autocmd discipline from my .vimrc:

    augroup vimrc_autocmd
      autocmd!
      "toggle quickfix window
      autocmd BufReadPost quickfix map  qq :cclose|map   |map   
    
      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
    

    The autocmd! at the beginning of the augroup block clears out the current group (vimrc_autocmd, in this case) before re-adding the autocmds.

提交回复
热议问题