This repository has been archived by the owner on Jan 11, 2019. It is now read-only.
forked from carlhuda/janus
-
Notifications
You must be signed in to change notification settings - Fork 0
Rvm
eMxyzptlk edited this page Dec 3, 2011
·
7 revisions
RVM set the GEM_HOME and GEM_PATH environment variables which causes Vim to try loading gems from the GEM_HOME, which results in errors even if the gems are actually installed in system ruby. For example the Hammer plugin requires github-markup which is installed automatically by Janus, but GEM_HOME causes rubygems to try loading the gem from that folder instead of the rubygems default folder.
Unless someone come up with a better solution, the only reasonable solution I was able to find is to wrap vim and all the aliases with a function that unset these environment variables, here's a function that does this which you can add to your .bashrc or .zshrc (do not forget to call it after defining it!)
# Define Vim wrappers which unsets GEM_HOME and GEM_PATH before
# invoking vim and all known aliases
#
# @author Wael Nasreddine <[email protected]>
function define_vim_wrappers()
{
vim_commands=(
eview evim gview gvim gvimdiff gvimtutor rgview
rgvim rview rvim vim vimdiff vimtutor xxd mvim
)
for cmd in ${vim_commands[@]}; do
cmd_path=`/usr/bin/env which -a "${cmd}" 2>/dev/null | grep '^/'`
if [ -x "${cmd_path}" ]; then
eval "function ${cmd} () { unset GEM_HOME; unset GEM_PATH; $cmd_path \$@ }"
fi
done
}
Call it with
define_vim_wrappers