diff --git a/plugins/bazel/README.md b/plugins/bazel/README.md index eba4175bc..b0c34a15f 100644 --- a/plugins/bazel/README.md +++ b/plugins/bazel/README.md @@ -1,6 +1,7 @@ # Bazel plugin -This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects. +This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool +that scalably supports multi-language and multi-platform projects. To use it, add `bazel` to the plugins array in your zshrc file: @@ -14,9 +15,15 @@ The plugin has a copy of [the completion script from the git repository][1]. ## Aliases -| Alias | Command | Description | -| ------- | -------------------------------------- | ------------------------------------------------------ | -| bzb | `bazel build` | The `bazel build` command | -| bzt | `bazel test` | The `bazel test` command | -| bzr | `bazel run` | The `bazel run` command | -| bzq | `bazel query` | The `bazel query` command | +| Alias | Command | Description | +| ----- | ------------- | ------------------------- | +| bzb | `bazel build` | The `bazel build` command | +| bzt | `bazel test` | The `bazel test` command | +| bzr | `bazel run` | The `bazel run` command | +| bzq | `bazel query` | The `bazel query` command | + +## Functions + +| Function | Description | +| -------- | -------------------------------- | +| sri-hash | Generate SRI hash used by bzlmod | diff --git a/plugins/bazel/bazel.plugin.zsh b/plugins/bazel/bazel.plugin.zsh index d239a06b5..818d5652b 100644 --- a/plugins/bazel/bazel.plugin.zsh +++ b/plugins/bazel/bazel.plugin.zsh @@ -3,3 +3,7 @@ alias bzb='bazel build' alias bzt='bazel test' alias bzr='bazel run' alias bzq='bazel query' + +sri-hash() { + openssl dgst -sha256 -binary $1 | openssl base64 -A | sed 's/^/sha256-/' +} diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh index f6801a870..9abd691c7 100644 --- a/plugins/dash/dash.plugin.zsh +++ b/plugins/dash/dash.plugin.zsh @@ -1,5 +1,5 @@ # Usage: dash [keyword:]query -dash() { open -a Dash.app dash://"$*" } +dash() { open -a Dash.app "dash://$(omz_urlencode -r $*)" } compdef _dash dash _dash() { diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh index f81c266a4..76d66b301 100644 --- a/plugins/pipenv/pipenv.plugin.zsh +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then if [[ ! -f "$PWD/Pipfile" ]]; then if [[ "$PIPENV_ACTIVE" == 1 ]]; then if [[ "$PWD" != "$pipfile_dir"* ]]; then - exit + unset PIPENV_ACTIVE pipfile_dir + deactivate fi fi fi @@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then if [[ "$PIPENV_ACTIVE" != 1 ]]; then if [[ -f "$PWD/Pipfile" ]]; then export pipfile_dir="$PWD" - pipenv shell + source "$(pipenv --venv)/bin/activate" + export PIPENV_ACTIVE=1 fi fi } diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md index 95d79cb52..2476bbd95 100644 --- a/plugins/pyenv/README.md +++ b/plugins/pyenv/README.md @@ -26,6 +26,14 @@ eval "$(pyenv init --path)" - `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv when it finds it. +- `ZSH_THEME_PYENV_NO_SYSTEM`: if set to `true`, the plugin will not show the system or + default Python version when it finds it. +- `ZSH_THEME_PYENV_PREFIX`: the prefix to display before the Python version in + the prompt. + +- `ZSH_THEME_PYENV_SUFFIX`: the prefix to display after the Python version in + the prompt. + ## Functions - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index b5c9a7bd3..cd2a9e0ac 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -88,13 +88,19 @@ if [[ $FOUND_PYENV -eq 1 ]]; then function pyenv_prompt_info() { local version="$(pyenv version-name)" - echo "${version:gs/%/%%}" + if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]] && [[ "${version}" == "system" ]]; then + return + fi + echo "${ZSH_THEME_PYENV_PREFIX=}${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}" } else # Fall back to system python function pyenv_prompt_info() { + if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]]; then + return + fi local version="$(python3 -V 2>&1 | cut -d' ' -f2)" - echo "system: ${version:gs/%/%%}" + echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}" } fi diff --git a/plugins/tailscale/tailscale.plugin.zsh b/plugins/tailscale/tailscale.plugin.zsh index 7f0b1414a..e0e011196 100644 --- a/plugins/tailscale/tailscale.plugin.zsh +++ b/plugins/tailscale/tailscale.plugin.zsh @@ -1,4 +1,4 @@ -if (( ! $+commands[tailscale] )); then +if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then return fi @@ -7,7 +7,12 @@ fi if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then typeset -g -A _comps autoload -Uz _tailscale - _comps[tailscale]=_tailscale + + if (( $+commands[tailscale] )); then + _comps[tailscale]=_tailscale + elif (( $+aliases[tailscale] )); then + _comps[${aliases[tailscale]:t}]=_tailscale + fi fi tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &| diff --git a/plugins/timoni/README.md b/plugins/timoni/README.md new file mode 100644 index 000000000..8701ede48 --- /dev/null +++ b/plugins/timoni/README.md @@ -0,0 +1,9 @@ +# Timoni plugin + +This plugin adds completion for [Timoni](https://timoni.sh), a package manager for Kubernetes, powered by CUE and inspired by Helm. + +To use it, add `timoni` to the plugins array in your zshrc file: + +```zsh +plugins=(... timoni) +``` diff --git a/plugins/timoni/timoni.plugin.zsh b/plugins/timoni/timoni.plugin.zsh new file mode 100644 index 000000000..971eda0b4 --- /dev/null +++ b/plugins/timoni/timoni.plugin.zsh @@ -0,0 +1,14 @@ +# Autocompletion for the Timoni CLI (timoni). +if (( ! $+commands[timoni] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `timoni`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_timoni" ]]; then + typeset -g -A _comps + autoload -Uz _timoni + _comps[timoni]=_timoni +fi + +timoni completion zsh >| "$ZSH_CACHE_DIR/completions/_timoni" &| diff --git a/plugins/vault/README.md b/plugins/vault/README.md new file mode 100644 index 000000000..cc270a385 --- /dev/null +++ b/plugins/vault/README.md @@ -0,0 +1,9 @@ +# Vault plugin + +This plugin adds completion for [Vault](https://www.vaultproject.io/), the secrets and sensitive data manager. + +To use it, add `vault` to the plugins array in your zshrc file: + +```zsh +plugins=(... vault) +``` diff --git a/plugins/vault/vault.plugin.zsh b/plugins/vault/vault.plugin.zsh new file mode 100644 index 000000000..996cd12ad --- /dev/null +++ b/plugins/vault/vault.plugin.zsh @@ -0,0 +1,7 @@ +# Completion +if (( ! $+commands[vault] )); then + return +fi + +autoload -Uz bashcompinit && bashcompinit +complete -o nospace -C vault vault