I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile it
It can be convenient to trace the --startime
when opening a particular file
gvim app/views/layouts/application.html.erb --startuptime time.log
I refined the vim -V solution by innaM to show the delta time:
vim -V 2>&1 | perl -MTime::HiRes=time -ne '$a = time unless defined $a; print time - $a, ": ", $_' | tee vilog
I created this Github project in order to better answer your question. Basically, it calls vim
's built-in profiler with appropriate flags and options, then sums up the timing for each function calls for every plugins, which is not obvious (but important) from the raw vim --profile
output. Bash, Python, R, Ruby and Perl are supported (you don't need to install anything since you most likely have one of those already) for creating the profiling results.
You will get a result figure like this:
Along with text output like this:
Generating vim startup profile...
Parsing vim startup profile...
Crunching data and generating profile plot ...
Your plugins startup profile graph is saved
as `profile.png` under current directory.
==========================================
Top 10 Plugins That Slows Down Vim Startup
==========================================
1 105.13 "vim-colorschemes"
2 42.661 "vim-easytags"
3 31.173 "vim-vendetta"
4 22.02 "syntastic"
5 13.362 "vim-online-thesaurus"
6 7.888 "vim-easymotion"
7 6.931 "vim-airline"
8 6.608 "YankRing.vim"
9 5.266 "nerdcommenter"
10 5.017 "delimitMate"
==========================================
Done!
Isn't there a bash time
command that can be used like so:
time vim
EDIT: Doesn't include the scripts start up time. Use @jamessan suggestion instead.