12

I'm using https://github.com/carlhuda/janus vim distribution and clearly not satisfied with load time.

What would be the best way to profile and speed-up vim load time? Also would be interesting to compare load time with http://vim.spf13.com/

2

2 Answers 2

18

If you just want to see what's consuming start up time, then you can use the --startuptime option.

vim --startuptime timing.out

The file will look like this:

times in msec
 clock   self+sourced   self:  sourced script
 clock   elapsed:              other lines

000.000  000.000: --- VIM STARTING ---
000.000  000.000: Allocated generic buffers
000.000  000.000: locale set
000.000  000.000: GUI prepared
000.000  000.000: clipboard setup
000.000  000.000: window checked
000.000  000.000: inits 1
000.000  000.000: parsing arguments
000.000  000.000: expanding arguments
000.000  000.000: shell init
000.000  000.000: Termcap init
000.000  000.000: inits 2
000.000  000.000: init highlight
000.000  000.000  000.000: sourcing /usr/share/vim/vim74/debian.vim
000.000  000.000  000.000: sourcing $VIM/vimrc
000.000  000.000  000.000: sourcing /home/mccoyj1/.vim/autoload/pathogen.vim
008.004  004.002  004.002: sourcing /home/mccoyj1/.vim/bundle/janah/colors/janah.vim
040.022  032.018  032.018: sourcing /usr/share/vim/vim74/filetype.vim
...
1
  • 2
    E.g. vim --startuptime timing.out usual_file.txt
    – kenorb
    Feb 11, 2015 at 11:41
5

You can debug startup time by using the built in Vim profiler (tutorial)

If your version of vim is compiled with :profile you can run: vim --cmd 'profile start vimrc.profile' --cmd 'profile! file ~/.vimrc'

If not, your stuck debugging it manually by adding and removing plugins and seeing where the long startup times are coming from.

I personally don't recommend using a Vim distribution. If you don't know what every line in your .vimrc is doing, then it becomes difficult to track down problems, or find where two plugins happen to conflict. For my personal configuration, I've spent a few months adding and removing plugins, finding which ones work for me and which ones don't. Vim is highly customizable, so take advantage of the fact that it can be configured to work perfectly with your workflow.

1
  • I would add that output file is vimrc.profile in the current directory
    – A B
    Feb 4, 2015 at 23:02

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.