Would you believe me if I told you that opening a simple Ruby file on my 2011 MacBook Pro takes 11.34 seconds?
To test this, I've used this command:
$ vim --startuptime log-before.txt app/models/user.rb
This command will time everything that Vim does until the file is ready for you to edit down to the millisecond. This is a great way to find out what's slowing things down.
I'll highlight the most interesting parts of [`log-before.txt`](https://gist.github.com/2147190#file_log_before.txt) here:
These are the _big spenders_ of loading a ruby file. Firstly there is `ruby.vim` taking about 5.4 seconds to load. Then there is `css.vim` taking another 3.9 seconds - and this file doesn't even include CSS!
These two time sinking hogs are keeping me back – 11 seconds at a time.
Let's see, `vim-css-color`. This plugin shows color hashes in their actual colour. So `#00f` will have a blue background. Great when editing CSS files, but not all that import. I removed `vim-css-color`.
_Note: the reason `vim-css-color` is slow with terminal vim is that is has to pre-compile colour hashes to ther xterm escape code equivalents. This is pretty time consuming._
Next up: `ruby.vim`. Why is this so bloody slow?
As it turns out, Vim has trouble finding the right `ruby` for me. This can be remedied by adding the following snippet to your `~/.vimrc`. It sets a logical search path for `ruby`:
if !empty($MY_RUBY_HOME)
let g:ruby_path = join(split(glob($MY_RUBY_HOME.'/lib/ruby/*.*')."\n".glob($MY_RUBY_HOME.'/lib/ruby/site_ruby/*'),"\n"),',')
endif
Again I ran my timer command ([full output](https://gist.github.com/2147190#file_log_after.txt)):