Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
079dbff2
Unverified
Commit
079dbff2
authored
Sep 06, 2023
by
Carlo Sala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(pipenv): add option to disable auto shell feature
Closes #11472
parent
6a7aab47
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
README.md
plugins/pipenv/README.md
+13
-0
pipenv.plugin.zsh
plugins/pipenv/pipenv.plugin.zsh
+8
-6
No files found.
plugins/pipenv/README.md
View file @
079dbff2
# Pipenv
## Installation
In your
`.zshrc`
file, add
`pipenv`
to the plugins section
```
...
...
@@ -8,7 +9,9 @@ plugins=(... pipenv ...)
```
## Features
This plugin provides some features to simplify the use of Pipenv while working on ZSH.
-
Adds completion for pipenv
-
Auto activates and deactivates pipenv shell
-
Adds short aliases for common pipenv commands
...
...
@@ -27,3 +30,13 @@ This plugin provides some features to simplify the use of Pipenv while working o
-
`pwh`
is aliased to
`pipenv --where`
-
`pvenv`
is aliased to
`pipenv --venv`
-
`ppy`
is aliased to
`pipenv --py`
## Configuration
### Shell activation
If you want to disable the shell activation and deactivation feature, add the following style to your
`.zshrc`
before sourcing
`oh-my-zsh.sh`
:
```
zsh
zstyle
':omz:plugins:pipenv'
auto-shell no
```
plugins/pipenv/pipenv.plugin.zsh
View file @
079dbff2
...
...
@@ -12,8 +12,9 @@ fi
_PIPENV_COMPLETE
=
zsh_source pipenv
>
|
"
$ZSH_CACHE_DIR
/completions/_pipenv"
&|
# Automatic pipenv shell activation/deactivation
_togglePipenvShell
()
{
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
...
...
@@ -30,10 +31,11 @@ _togglePipenvShell() {
pipenv shell
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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment