summaryrefslogtreecommitdiff
path: root/plugins/pipenv/pipenv.plugin.zsh
diff options
context:
space:
mode:
authorCarlo Sala <carlosalag@protonmail.com>2023-09-06 19:01:41 +0200
committerCarlo Sala <carlosalag@protonmail.com>2023-09-06 19:01:41 +0200
commit079dbff2c4f22935a71101c511e2285327d8ab68 (patch)
treecc84e8fb9e4e6349fb301e50dc484b31e0342a77 /plugins/pipenv/pipenv.plugin.zsh
parent6a7aab47dd6071b7f264477195b06efb7e7bd480 (diff)
downloadzsh-079dbff2c4f22935a71101c511e2285327d8ab68.tar.gz
zsh-079dbff2c4f22935a71101c511e2285327d8ab68.tar.bz2
zsh-079dbff2c4f22935a71101c511e2285327d8ab68.zip
feat(pipenv): add option to disable auto shell feature
Closes #11472
Diffstat (limited to 'plugins/pipenv/pipenv.plugin.zsh')
-rw-r--r--plugins/pipenv/pipenv.plugin.zsh38
1 files changed, 20 insertions, 18 deletions
diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh
index 22d1a3131..f81c266a4 100644
--- a/plugins/pipenv/pipenv.plugin.zsh
+++ b/plugins/pipenv/pipenv.plugin.zsh
@@ -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"