3

Vim was much faster on the time when I installed it freshly. It now takes 2-4 seconds from the time I hit enter after typing vim inside terminal and the opening of Vim (even without any file/argument).

I have:

  • 7 plugins (autocorrect, auto-pairs, closetag, snipMate, supertab, tetris)
  • No colorschemes
  • A .vimrc file with these configurations
  • The .vimrc file in my home directory is a symlink, the real file is in .vim directory
  • I am starting Vim in insert mode (I have alias in .bash_aliases file):

    alias vim="vim -c 'startinsert'"
    alias vi="vi -c 'startinsert'"
    

What is slowing down my Vim?

1
  • One thing to try is to run vim -X and see if it starts up quicker. I had slowness issues that were related to vim trying to connect to a non-existent X server. Jul 21, 2012 at 20:49

2 Answers 2

22

I'm almost sure that autocorrect.vim is the reason. Just looked into it and saw 8152 lines. All these lines are parsed by Vim at its startup, which slows it down.

For the future. You can start vim with --startuptime argument to know exactly what slows down its loading, e.g.

vim --startuptime startup.report

Examining of produced file will give you information about time spent for loading different scripts.

1
  • Nice, so is it autocorrect.vim who slowed down startup of your Vim or there is/was another reason for that?
    – xaizek
    Jul 22, 2012 at 10:22
2

Check the size of your viminfo file.

ls -l ~/.viminfo

My VIM becomes really slow when this file grows to very large (200MB) and everytime VIM quits, it needs to write to this file and it's pretty slow. The reason that this file gets really large for me is 1: I used VIM for long, and 2: I yank/copy very large text in VIM and all those text appear in .viminfo.

Do

rm ~/.viminf*

make sure to remove ~/.viminfz.*. Otherwise, .viminfo will be restored even if you delete .viminfo.

After they are removed, my VIM is as fast as it should be.

You can also log via

vim -V12log test.txt

to see what is being done (I found that vim is trying to write to .viminfo in the log).

There are also starttime record feature provided by vim refer to this Vim response quite slow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.