Lately vim takes a long time to start up when I'm running it to edit a ruby file or a rails project. But it starts up fast when invoked on a plain text file. Is there any way to find out which ruby vim plugins are most responsible for prolonging the startup?
If you're using version 7.2.286 or newer, you can run vim --startuptime vim.out foo.rb
to log how long the various parts of the startup process take.
The reason for slowliness is often the not set or wrong set ruby_path on compile time of vim (see also discussion on google vim/ruby google group). It is easier to set it in vimrc, because you can change it without recompiling vim. You can set the path through the g:ruby_path variable in your .vimrc file. This is for OS X, but you can change it to be right for Linux. Don't copy and paste both, use the right one.
If you use RBENV add this to your .vimrc:
" ruby path if you are using rbenv
let g:ruby_path = system('echo $HOME/.rbenv/shims')
If you use RVM add this to your .vimrc:
" ruby path if you are using RVM
let g:ruby_path = system('rvm current')
For me the part on loading ruby specific functions in vim got 10 times faster.
If you are using jruby, than the start up slowliness can be even bigger. See examples for fixing it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With