Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see which plugins are making Vim slow?

Is there a way to profile Vim plugins?

My MacVim becomes slower and slower when I open a large .py. I know I could deselect all plugins and reselect one by one to check which plugin is the culprit, but is there a faster way?

My dotvim is here: https://github.com/charlax/dotvim

like image 483
charlax Avatar asked Aug 31 '12 10:08

charlax


People also ask

Do plugins slow down vim?

Some plugins may load fast, but will significantly slow down your vim when they are running: ale.

Why is vim so slow?

First, get a feel for how fast Vim can be: run with vim -u NONE and comment out everything in your . vimrc - then do the single thing that seems slow. Run without the -u NONE and compare. It should be just as fast, or some plugin is autoloaded and is causing problems.


2 Answers

You can use built-in profiling support: after launching vim do

:profile start profile.log :profile func * :profile file * " At this point do slow actions :profile pause :noautocmd qall! 

(unlike quitting noautocmd is not really required, it just makes vim quit faster).

Note: you won’t get information about functions there were deleted before vim quit.

like image 136
ZyX Avatar answered Sep 18 '22 04:09

ZyX


I found another very helpful vim buildin method to show the exactly timing messages while loading your .vimrc.

vim --startuptime timeCost.txt timeCost.txt 

Please run:

:help --startuptime 

in VIM to get more information.

like image 25
feihu Avatar answered Sep 18 '22 04:09

feihu