Why won't macvim always use ruby 1.9.3?

macvim, ruby, vim

Solution

It took me awhile to find a fix, but the issue is caused by MacVim not loading zsh the same way Terminal loads zsh.

The fix is easy enough and can be placed into your zshrc. See a commit from my dotfiles:

https://github.com/simeonwillbanks/dotfiles/commit/e0e19cfeff13f8bc99d8164217ddd84c6d7f9529

The commit references a full explanation which can be found here:

http://vim.1045645.n5.nabble.com/MacVim-and-PATH-tt3388705.html#a3392363

Hope this helps!

Problem

I have installed yadr dotfiles, a set of vim, ruby, etc plugins. I have the following line of Ruby code in a file `foo.rb`: `foo: bar` Note I used the ruby 1.9.3 syntax for symbol assignment/definition. When I start macvim from command line using `mvim foo.rb` and save that file, everything works fine. However, when I open macvim using `open -a macvim` and navigate to and open `foo.rb`, when I try to save the file I get a ruby-vim syntax error on `foo: bar`. When I change it to `:foo => bar` I don't get syntax errors. - Using `open -a macvim` to open macvim, and then entering `:!ruby -v` prints `ruby 1.8.7` - Using `mvim .` to open macvim, and then entering `:!ruby -v` prints `ruby 1.9.3` Depending on how I open macvim, I get a different version of Ruby. How do I ensure that macvim always uses ruby 1.9.3 to evaluate my ruby code? Thanks

Original source