load_pyenv.fish 803 B

12345678910111213141516171819202122232425262728293031323334
  1. # pyenv setup
  2. set -gx PYENV_ROOT $HOME/.pyenv
  3. set -l pyenv_bin $PYENV_ROOT/bin
  4. set -l pyenv_shims $PYENV_ROOT/shims
  5. # echo $os # returns my local `os` env var
  6. for p in $pyenv_bin and $pyenv_shims
  7. if not contains $p $PATH && test -d $p
  8. set -gx PATH $p $PATH
  9. end
  10. end
  11. set -gx PYENV_SHELL fish
  12. source $HOME/.pyenv/libexec/../completions/pyenv.fish
  13. # NOTE for reasons I do NOT know the below statement will bolt on ~ 200ms to fish load time
  14. # command pyenv rehash 2>/dev/null
  15. function pyenv
  16. set command $argv[1]
  17. set -e argv[1]
  18. switch "$command"
  19. case activate deactivate rehash shell
  20. source (pyenv "sh-$command" $argv|psub)
  21. case '*'
  22. command pyenv "$command" $argv
  23. end
  24. end
  25. if type -q virtualenv
  26. set -gx VIRTUAL_ENV_DISABLE_PROMPT 1 # disable default virtualenv prompt
  27. end