Skip to content

Make the fish prompt faster #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions bin/pyenv-virtualenv-init
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,19 @@ esac
case "$shell" in
fish )
cat <<EOS
function _pyenv_virtualenv_hook --on-event fish_prompt;
function _pyenv_virtualenv_hook --on-variable PWD --on-variable PYENV_VERSION;
set -l ret \$status
if [ -n "\$VIRTUAL_ENV" ]
pyenv activate --quiet; or pyenv deactivate --quiet; or true
function _pyenv_activate_or_deactivate
pyenv activate --quiet || pyenv deactivate --quiet
end
_pyenv_activate_or_deactivate &
else
pyenv activate --quiet; or true
pyenv activate --quiet &
end
return \$ret
end
_pyenv_virtualenv_hook
EOS
;;
ksh )
Expand Down
10 changes: 7 additions & 3 deletions test/init.bats
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ while set index (contains -i -- "${TMP}/pyenv/plugins/pyenv-virtualenv/shims" \$
set -eg PATH[\$index]; end; set -e index
set -gx PATH '${TMP}/pyenv/plugins/pyenv-virtualenv/shims' \$PATH;
set -gx PYENV_VIRTUALENV_INIT 1;
function _pyenv_virtualenv_hook --on-event fish_prompt;
function _pyenv_virtualenv_hook --on-variable PWD --on-variable PYENV_VERSION;
set -l ret \$status
if [ -n "\$VIRTUAL_ENV" ]
pyenv activate --quiet; or pyenv deactivate --quiet; or true
function _pyenv_activate_or_deactivate
pyenv activate --quiet || pyenv deactivate --quiet
end
_pyenv_activate_or_deactivate &
else
pyenv activate --quiet; or true
pyenv activate --quiet &
end
return \$ret
end
_pyenv_virtualenv_hook
EOS
}

Expand Down