chezmoi init

This commit is contained in:
Cy Pokhrel 2024-10-22 11:11:45 -04:00
commit 530d6d7195
No known key found for this signature in database
GPG key ID: 1200FBE36C2ADE2E
1176 changed files with 111325 additions and 0 deletions

View file

@ -0,0 +1,40 @@
# Pipenv
This plugin provides some features to simplify the use of [Pipenv](https://pipenv.pypa.io/) while working on ZSH.
In your `.zshrc` file, add `pipenv` to the plugins section
```
plugins=(... pipenv ...)
```
## Features
- Adds completion for pipenv
- Auto activates and deactivates pipenv shell
- Adds short aliases for common pipenv commands
- `pch` is aliased to `pipenv check`
- `pcl` is aliased to `pipenv clean`
- `pgr` is aliased to `pipenv graph`
- `pi` is aliased to `pipenv install`
- `pidev` is aliased to `pipenv install --dev`
- `pl` is aliased to `pipenv lock`
- `po` is aliased to `pipenv open`
- `prun` is aliased to `pipenv run`
- `psh` is aliased to `pipenv shell`
- `psy` is aliased to `pipenv sync`
- `pu` is aliased to `pipenv uninstall`
- `pupd` is aliased to `pipenv update`
- `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
```

View file

@ -0,0 +1,55 @@
if (( ! $+commands[pipenv] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `pipenv`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_pipenv" ]]; then
typeset -g -A _comps
autoload -Uz _pipenv
_comps[pipenv]=_pipenv
fi
_PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &|
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
# activate the shell if Pipfile exists
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
if [[ -f "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
pipenv shell
fi
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePipenvShell
_togglePipenvShell
fi
# Aliases
alias pch="pipenv check"
alias pcl="pipenv clean"
alias pgr="pipenv graph"
alias pi="pipenv install"
alias pidev="pipenv install --dev"
alias pl="pipenv lock"
alias po="pipenv open"
alias prun="pipenv run"
alias psh="pipenv shell"
alias psy="pipenv sync"
alias pu="pipenv uninstall"
alias pupd="pipenv update"
alias pwh="pipenv --where"
alias pvenv="pipenv --venv"
alias ppy="pipenv --py"