A common hack Thoughtbot use is to add project binstubs to the PATH. For example, if we’ve got rspec in our bin directory, we can just run rspec instead of bin/rspec or bundle exec rspec.
It worked when I used rbenv, but since moving to chruby, it doesn’t work anymore. No matter what I do, the path to my ruby is appears first in my $PATH.
Here’s an excerpt from my zshenv:
if [[ -e /usr/local/share/chruby ]]; then
source '/usr/local/share/chruby/chruby.sh'
source '/usr/local/share/chruby/auto.sh'
if [[ -f ~/.ruby-version ]]; then
chruby $(cat ~/.ruby-version)
fi
fi
export PATH="$HOME/.bin:$PATH"
# mkdir -p .git/safe in the root of repositories you trust
export PATH=".git/safe/../../bin:$PATH"
@christoomey How do you set up your PATH so that vim plugins like spec runners find the right gem if you only use bundle exec? I’ve found some plugins don’t easily allow me to override the command it runs, i.e. they expect to be able to run command like rspec on their own and just work.
I actually do very little with Vim integrating to external commands, and instead use tmux functionality to interact with the commands. I’m a fan of the Vim / Unix approach of singular focus for a given tool, so I keep Vim focused on editing, with tmux allowing me to interact with those commands as needed from Vim.