How to run the proper version of Ruby when executing through MacVim (!ruby)

Viewed 1675

Recently I saw Gary Bernhardt show off a vim shortcut he uses to execute Ruby code from within vim. The shortcut is

:map ,t :w\|:!ruby %<cr>.  

It seems that this method always execute's the System Ruby, which in my case is 1.8.7. I'm hesitant to upgrade this as I've heard that changing the System Ruby interpreter can cause some wonky issues. Is there anyway to get this command to use the version setup for the directory with RVM?

2 Answers
Related