mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
parent
6a7aab47dd
commit
079dbff2c4
2 changed files with 34 additions and 19 deletions
|
|
@ -12,28 +12,30 @@ fi
|
|||
|
||||
_PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &|
|
||||
|
||||
# Automatic pipenv shell activation/deactivation
|
||||
_togglePipenvShell() {
|
||||
# deactivate shell if Pipfile doesn't exist and not in a subdir
|
||||
if [[ ! -f "$PWD/Pipfile" ]]; then
|
||||
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
|
||||
if [[ "$PWD" != "$pipfile_dir"* ]]; then
|
||||
exit
|
||||
if zstyle -T ':omz:plugins:pipenv' auto-shell; then
|
||||
# Automatic pipenv shell activation/deactivation
|
||||
_togglePipenvShell() {
|
||||
# deactivate shell if Pipfile doesn't exist and not in a subdir
|
||||
if [[ ! -f "$PWD/Pipfile" ]]; then
|
||||
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
|
||||
if [[ "$PWD" != "$pipfile_dir"* ]]; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# activate the shell if Pipfile exists
|
||||
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
|
||||
if [[ -f "$PWD/Pipfile" ]]; then
|
||||
export pipfile_dir="$PWD"
|
||||
pipenv shell
|
||||
# activate the shell if Pipfile exists
|
||||
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
|
||||
if [[ -f "$PWD/Pipfile" ]]; then
|
||||
export pipfile_dir="$PWD"
|
||||
pipenv shell
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd _togglePipenvShell
|
||||
_togglePipenvShell
|
||||
}
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd _togglePipenvShell
|
||||
_togglePipenvShell
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
alias pch="pipenv check"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue