Skip to content

Instantly share code, notes, and snippets.

@seraph
Created February 20, 2016 12:19
Show Gist options
  • Save seraph/54225b99397eb391139b to your computer and use it in GitHub Desktop.
Save seraph/54225b99397eb391139b to your computer and use it in GitHub Desktop.
Working Fish shell config for nvm and rbenv support (with rbenv shell support)
# taken from https://github.com/rbenv/rbenv/pull/375
# and https://coderwall.com/p/6hja1w/rbenv-shell-and-fish
source ~/.config/fish/nvm-wrapper/nvm.fish
set PATH $HOME/.rbenv/bin $PATH
set -x PATH $HOME/.rbenv/shims $PATH
rbenv rehash >/dev/null ^&1
function rbenv_shell
set -l vers $argv[1]
switch "$vers"
case '--complete'
echo '--unset'
echo 'system'
exec rbenv-versions --bare
return
case '--unset'
set -e RBENV_VERSION
case ''
if [ -z "$RBENV_VERSION" ]
echo "rbenv: no shell-specific version configured" >&2
return 1
else
echo "$RBENV_VERSION"
end
case '*'
rbenv prefix "$vers" > /dev/null
set -g -x RBENV_VERSION "$vers"
end
end
function rbenv
set -l command $argv[1]
[ (count $argv) -gt 1 ]; and set -l args $argv[2..-1]
switch "$command"
case shell
rbenv_shell $args
case '*'
command rbenv $command $args
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment