Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

do ruby plugins make starting vim very slow?

Tags:

vim

ruby

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?

like image 876
dan Avatar asked Oct 03 '10 01:10

dan


2 Answers

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.

like image 191
jamessan Avatar answered Sep 22 '22 16:09

jamessan


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.

like image 31
Fa11enAngel Avatar answered Sep 22 '22 16:09

Fa11enAngel