1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2026-04-27 16:53:30 +02:00

Compare commits

...

22 Commits

Author SHA1 Message Date
Dylan Roman 278ee100fc fix(git): replace deprecated syntax for percent substitution in prompt (#13705) (#13706)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-04-27 14:50:08 +02:00
Stephan Schielke 52c830cd32 fix(poetry-env): handle Poetry returning "." for venv path (#13183) 2026-04-27 11:06:54 +02:00
Thomas Renoth 8c3cce964a feat(bgnotify): add niri WM support (#13707) 2026-04-27 09:33:31 +02:00
ohmyzsh[bot] d50115afd6 chore(z): update to version ae10ba3f (#13710)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-04-27 09:20:10 +02:00
dependabot[bot] 232c6e4d8d chore(deps): bump idna from 3.11 to 3.13 in /.github/workflows/dependencies (#13712)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-27 09:19:09 +02:00
dependabot[bot] 50c56eb49b chore(deps): bump certifi from 2026.2.25 to 2026.4.22 in /.github/workflows/dependencies (#13713)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-27 09:15:39 +02:00
dependabot[bot] bbe8cace5a chore(deps): bump step-security/harden-runner from 2.18.0 to 2.19.0 (#13711)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-27 09:15:13 +02:00
Truffle 349b9e49ce docs(kubectl): add missing aliases (#13699) 2026-04-20 11:01:03 +02:00
chaoliang yan a4ee4daf3c fix(tmux): treat xterm-direct as 256-color (#13700)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: lawrence3699 <lawrence3699@users.noreply.github.com>
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2026-04-20 11:00:37 +02:00
dependabot[bot] 7a6357cbf6 chore(deps): bump step-security/harden-runner from 2.17.0 to 2.18.0 (#13697)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 10:55:24 +02:00
dependabot[bot] 106b887c1f chore(deps): bump github/codeql-action from 4.35.1 to 4.35.2 (#13698)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 10:54:07 +02:00
Carlo Sala e42ac8c57b ci: add strong permission (#13694) 2026-04-16 19:05:24 +02:00
Carlo Sala 061f773dd3 ci: use client-id rather than app-id (#13690) 2026-04-13 11:31:03 +02:00
dependabot[bot] c53cfb2de4 chore(deps): bump actions/create-github-app-token from 3.0.0 to 3.1.1 (#13689)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-13 10:51:45 +02:00
dependabot[bot] 1708d84b70 chore(deps): bump step-security/harden-runner from 2.16.1 to 2.17.0 (#13687)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-13 09:54:42 +02:00
dependabot[bot] 46c673072e chore(deps): bump actions/upload-artifact from 7.0.0 to 7.0.1 (#13688)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-13 09:54:23 +02:00
Chris Schindlbeck 7c10d9839f feat(terraform): add aliases for terraform: tfapp, tfpo 2026-04-07 12:25:32 +02:00
Chris Schindlbeck 103246c198 feat(opentofu): add aliases for opentofu: ttap, ttapp, ttir, ttiu, ttiur, ttpo 2026-04-07 12:25:32 +02:00
dependabot[bot] 887a864aba chore(deps): bump charset-normalizer in /.github/workflows/dependencies (#13669)
Bumps [charset-normalizer](https://github.com/jawah/charset_normalizer) from 3.4.6 to 3.4.7.
- [Release notes](https://github.com/jawah/charset_normalizer/releases)
- [Changelog](https://github.com/jawah/charset_normalizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jawah/charset_normalizer/compare/3.4.6...3.4.7)

---
updated-dependencies:
- dependency-name: charset-normalizer
  dependency-version: 3.4.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-05 19:28:10 +02:00
dependabot[bot] d1fb3ebfc7 chore(deps): bump requests in /.github/workflows/dependencies (#13668)
Bumps [requests](https://github.com/psf/requests) from 2.33.0 to 2.33.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.33.0...v2.33.1)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-05 19:27:23 +02:00
dependabot[bot] beab0c0b3c chore(deps): bump step-security/harden-runner from 2.16.0 to 2.16.1 (#13667)
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.16.0 to 2.16.1.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594...fe104658747b27e96e4f7e80cd0a94068e53901d)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-version: 2.16.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-05 19:26:46 +02:00
ohmyzsh[bot] f0e2160abb chore(kube-ps1): update to e19c9ee8 (#13666)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2026-04-05 14:39:19 +02:00
19 changed files with 178 additions and 80 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ dependencies:
plugins/kube-ps1: plugins/kube-ps1:
repo: jonmosco/kube-ps1 repo: jonmosco/kube-ps1
branch: master branch: master
version: 9b41c091d5dd4a99e58cf58b5d98a4847937b1bb version: e19c9ee867c5655814c384a6bf543e330e6ef1b7
precopy: | precopy: |
set -e set -e
find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
@@ -46,7 +46,7 @@ dependencies:
plugins/z: plugins/z:
branch: master branch: master
repo: agkozak/zsh-z repo: agkozak/zsh-z
version: cf9225feebfae55e557e103e95ce20eca5eff270 version: ae10ba3f4674c24ac353fd34deb2fd9f7b061055
precopy: | precopy: |
set -e set -e
test -e README.md && mv -f README.md MANUAL.md test -e README.md && mv -f README.md MANUAL.md
+6 -3
View File
@@ -4,6 +4,9 @@ on:
schedule: schedule:
- cron: "0 6 * * 0" - cron: "0 6 * * 0"
permissions:
contents: read
jobs: jobs:
check: check:
name: Check for updates name: Check for updates
@@ -13,7 +16,7 @@ jobs:
contents: write # this is needed to push commits and branches contents: write # this is needed to push commits and branches
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with: with:
egress-policy: audit egress-policy: audit
@@ -23,9 +26,9 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
with: with:
app-id: ${{ secrets.OHMYZSH_APP_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
@@ -1,7 +1,7 @@
certifi==2026.2.25 certifi==2026.4.22
charset-normalizer==3.4.6 charset-normalizer==3.4.7
idna==3.11 idna==3.13
PyYAML==6.0.3 PyYAML==6.0.3
requests==2.33.0 requests==2.33.1
semver==3.0.4 semver==3.0.4
urllib3==2.6.3 urllib3==2.6.3
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
- macos-latest - macos-latest
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with: with:
egress-policy: audit egress-policy: audit
@@ -47,7 +47,7 @@ jobs:
- test - test
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with: with:
egress-policy: audit egress-policy: audit
+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with: with:
egress-policy: audit egress-policy: audit
+3 -3
View File
@@ -17,14 +17,14 @@ jobs:
if: github.repository == 'ohmyzsh/ohmyzsh' if: github.repository == 'ohmyzsh/ohmyzsh'
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with: with:
egress-policy: audit egress-policy: audit
- name: Authenticate as @ohmyzsh - name: Authenticate as @ohmyzsh
id: generate-token id: generate-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
with: with:
app-id: ${{ secrets.OHMYZSH_APP_ID }} client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
- name: Read project data - name: Read project data
env: env:
+3 -3
View File
@@ -36,7 +36,7 @@ jobs:
steps: steps:
- name: Harden the runner (Audit all outbound calls) - name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with: with:
egress-policy: audit egress-policy: audit
@@ -53,13 +53,13 @@ jobs:
publish_results: true publish_results: true
- name: "Upload artifact" - name: "Upload artifact"
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
retention-days: 5 retention-days: 5
- name: "Upload to code-scanning" - name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1 uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
with: with:
sarif_file: results.sarif sarif_file: results.sarif
+2 -2
View File
@@ -36,7 +36,7 @@ function _omz_git_prompt_info() {
&& upstream=" -> ${upstream}" && upstream=" -> ${upstream}"
fi fi
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref//\%/%%}${upstream//\%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
} }
function _omz_git_prompt_status() { function _omz_git_prompt_status() {
@@ -255,7 +255,7 @@ function git_remote_status() {
fi fi
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX${remote:gs/%/%%}$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX${remote//\%/%%}$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
fi fi
echo $git_remote_status echo $git_remote_status
+9
View File
@@ -67,6 +67,9 @@ function bgnotify_appid {
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
local app_id=$(bgnotify_find_sway_appid) local app_id=$(bgnotify_find_sway_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS [[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
elif [[ -n $NIRI_SOCKET ]]; then # niri
local app_id=$(bgnotify_find_niri_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
else else
@@ -106,6 +109,12 @@ function bgnotify_find_sway_appid {
fi fi
} }
function bgnotify_find_niri_appid {
if (( ${+commands[jq]} )); then
niri msg -j windows | jq '.[] | select(.is_focused) | {app_id, id} | join(",")'
fi
}
function bgnotify_programid { function bgnotify_programid {
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
iTerm.app) echo 'com.googlecode.iterm2' ;; iTerm.app) echo 'com.googlecode.iterm2' ;;
+23 -13
View File
@@ -55,7 +55,17 @@ _kube_ps1_shell_type() {
_kube_ps1_init() { _kube_ps1_init() {
[[ -f "${_KUBE_PS1_DISABLE_PATH}" ]] && KUBE_PS1_ENABLED=off [[ -f "${_KUBE_PS1_DISABLE_PATH}" ]] && KUBE_PS1_ENABLED=off
case "$(_kube_ps1_shell_type)" in # Detect shell type once and cache it
_KUBE_PS1_SHELL="$(_kube_ps1_shell_type)"
# Check tput availability once
if tput setaf 1 &> /dev/null; then
_KUBE_PS1_TPUT_AVAILABLE=true
else
_KUBE_PS1_TPUT_AVAILABLE=false
fi
case "${_KUBE_PS1_SHELL}" in
"zsh") "zsh")
_KUBE_PS1_OPEN_ESC="%{" _KUBE_PS1_OPEN_ESC="%{"
_KUBE_PS1_CLOSE_ESC="%}" _KUBE_PS1_CLOSE_ESC="%}"
@@ -96,10 +106,10 @@ _kube_ps1_color_fg() {
if [[ "${_KUBE_PS1_FG_CODE}" == "default" ]]; then if [[ "${_KUBE_PS1_FG_CODE}" == "default" ]]; then
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}" _KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
return return
elif [[ "$(_kube_ps1_shell_type)" == "zsh" ]]; then elif [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
_KUBE_PS1_FG_CODE="%F{$_KUBE_PS1_FG_CODE}" _KUBE_PS1_FG_CODE="%F{$_KUBE_PS1_FG_CODE}"
elif [[ "$(_kube_ps1_shell_type)" == "bash" ]]; then elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
if tput setaf 1 &> /dev/null; then if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
_KUBE_PS1_FG_CODE="$(tput setaf "${_KUBE_PS1_FG_CODE}")" _KUBE_PS1_FG_CODE="$(tput setaf "${_KUBE_PS1_FG_CODE}")"
elif [[ $_KUBE_PS1_FG_CODE -ge 0 ]] && [[ $_KUBE_PS1_FG_CODE -le 256 ]]; then elif [[ $_KUBE_PS1_FG_CODE -ge 0 ]] && [[ $_KUBE_PS1_FG_CODE -le 256 ]]; then
_KUBE_PS1_FG_CODE="\033[38;5;${_KUBE_PS1_FG_CODE}m" _KUBE_PS1_FG_CODE="\033[38;5;${_KUBE_PS1_FG_CODE}m"
@@ -129,15 +139,15 @@ _kube_ps1_color_bg() {
if [[ "${_KUBE_PS1_BG_CODE}" == "default" ]]; then if [[ "${_KUBE_PS1_BG_CODE}" == "default" ]]; then
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_BG}" _KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_BG}"
return return
elif [[ "$(_kube_ps1_shell_type)" == "zsh" ]]; then elif [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
_KUBE_PS1_BG_CODE="%K{$_KUBE_PS1_BG_CODE}" _KUBE_PS1_BG_CODE="%K{$_KUBE_PS1_BG_CODE}"
elif [[ "$(_kube_ps1_shell_type)" == "bash" ]]; then elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
if tput setaf 1 &> /dev/null; then if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
_KUBE_PS1_BG_CODE="$(tput setab "${_KUBE_PS1_BG_CODE}")" _KUBE_PS1_BG_CODE="$(tput setab "${_KUBE_PS1_BG_CODE}")"
elif [[ $_KUBE_PS1_BG_CODE -ge 0 ]] && [[ $_KUBE_PS1_BG_CODE -le 256 ]]; then elif [[ $_KUBE_PS1_BG_CODE -ge 0 ]] && [[ $_KUBE_PS1_BG_CODE -le 256 ]]; then
_KUBE_PS1_BG_CODE="\033[48;5;${_KUBE_PS1_BG_CODE}m" _KUBE_PS1_BG_CODE="\033[48;5;${_KUBE_PS1_BG_CODE}m"
else else
_KUBE_PS1_BG_CODE="${DEFAULT_BG}" _KUBE_PS1_BG_CODE="${_KUBE_PS1_DEFAULT_BG}"
fi fi
fi fi
echo "${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_BG_CODE}${_KUBE_PS1_CLOSE_ESC}" echo "${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_BG_CODE}${_KUBE_PS1_CLOSE_ESC}"
@@ -174,7 +184,7 @@ _kube_ps1_symbol() {
symbol="$(_kube_ps1_color_fg ${oc_symbol_color})${oc_glyph}${KUBE_PS1_RESET_COLOR}" symbol="$(_kube_ps1_color_fg ${oc_symbol_color})${oc_glyph}${KUBE_PS1_RESET_COLOR}"
;; ;;
*) *)
case "$(_kube_ps1_shell_type)" in case "${_KUBE_PS1_SHELL}" in
bash) bash)
if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388' != "\\u2388" ]]; then if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388' != "\\u2388" ]]; then
symbol="$(_kube_ps1_color_fg $custom_symbol_color)${symbol_default}${KUBE_PS1_RESET_COLOR}" symbol="$(_kube_ps1_color_fg $custom_symbol_color)${symbol_default}${KUBE_PS1_RESET_COLOR}"
@@ -212,7 +222,7 @@ _kube_ps1_file_newer_than() {
local file=$1 local file=$1
local check_time=$2 local check_time=$2
if [[ "$(_kube_ps1_shell_type)" == "zsh" ]]; then if [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
# Use zstat '-F %s.%s' to make it compatible with low zsh version (eg: 5.0.2) # Use zstat '-F %s.%s' to make it compatible with low zsh version (eg: 5.0.2)
mtime=$(zstat -L +mtime -F %s.%s "${file}") mtime=$(zstat -L +mtime -F %s.%s "${file}")
elif stat -c "%s" /dev/null &> /dev/null; then elif stat -c "%s" /dev/null &> /dev/null; then
@@ -292,13 +302,13 @@ _kube_ps1_get_ns() {
_kube_ps1_get_context_ns() { _kube_ps1_get_context_ns() {
# Set the command time # Set the command time
if [[ "$(_kube_ps1_shell_type)" == "bash" ]]; then if [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
if ((BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 2)); then if ((BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 2)); then
_KUBE_PS1_LAST_TIME=$(printf '%(%s)T') _KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
else else
_KUBE_PS1_LAST_TIME=$(date +%s) _KUBE_PS1_LAST_TIME=$(date +%s)
fi fi
elif [[ "$(_kube_ps1_shell_type)" == "zsh" ]]; then elif [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
_KUBE_PS1_LAST_TIME=$EPOCHREALTIME _KUBE_PS1_LAST_TIME=$EPOCHREALTIME
fi fi
@@ -325,7 +335,7 @@ Toggle kube-ps1 prompt on
Usage: kubeon [-g | --global] [-h | --help] Usage: kubeon [-g | --global] [-h | --help]
With no arguments, turn oon kube-ps1 status for this shell instance (default). With no arguments, turn on kube-ps1 status for this shell instance (default).
-g --global turn on kube-ps1 status globally -g --global turn on kube-ps1 status globally
-h --help print this message -h --help print this message
+16
View File
@@ -35,13 +35,16 @@ plugins=(... kubectl)
| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` | | kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` | | kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
| kgpsl | `kubectl get pods --show-labels` | List all pods in ps output format with labels | | kgpsl | `kubectl get pods --show-labels` | List all pods in ps output format with labels |
| kgpa | `kubectl get pods --all-namespaces` | List all pods in ps output format across all namespaces |
| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes | | kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included | | kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
| kgpall | `kubectl get pods --all-namespaces -o wide` | List all pods across all namespaces in wide output format (including node name) |
| kep | `kubectl edit pods` | Edit pods from the default editor | | kep | `kubectl edit pods` | Edit pods from the default editor |
| kdp | `kubectl describe pods` | Describe all pods | | kdp | `kubectl describe pods` | Describe all pods |
| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments | | kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
| | | **Service management** | | | | **Service management** |
| kgs | `kubectl get svc` | List all services in ps output format | | kgs | `kubectl get svc` | List all services in ps output format |
| kgsa | `kubectl get svc --all-namespaces` | List all services across all namespaces |
| kgsw | `kgs --watch` | After listing all services, watch for changes | | kgsw | `kgs --watch` | After listing all services, watch for changes |
| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information | | kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
| kes | `kubectl edit svc` | Edit services(svc) from the default editor | | kes | `kubectl edit svc` | Edit services(svc) from the default editor |
@@ -49,6 +52,7 @@ plugins=(... kubectl)
| kdels | `kubectl delete svc` | Delete all services matching passed argument | | kdels | `kubectl delete svc` | Delete all services matching passed argument |
| | | **Ingress management** | | | | **Ingress management** |
| kgi | `kubectl get ingress` | List ingress resources in ps output format | | kgi | `kubectl get ingress` | List ingress resources in ps output format |
| kgia | `kubectl get ingress --all-namespaces` | List ingress resources across all namespaces |
| kei | `kubectl edit ingress` | Edit ingress resource from the default editor | | kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
| kdi | `kubectl describe ingress` | Describe ingress resource in detail | | kdi | `kubectl describe ingress` | Describe ingress resource in detail |
| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument | | kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
@@ -60,15 +64,18 @@ plugins=(... kubectl)
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace | | kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
| | | **ConfigMap management** | | | | **ConfigMap management** |
| kgcm | `kubectl get configmaps` | List the configmaps in ps output format | | kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
| kgcma | `kubectl get configmaps --all-namespaces` | List configmaps across all namespaces |
| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor | | kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
| kdcm | `kubectl describe configmap` | Describe configmap resource in detail | | kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
| kdelcm | `kubectl delete configmap` | Delete the configmap | | kdelcm | `kubectl delete configmap` | Delete the configmap |
| | | **Secret management** | | | | **Secret management** |
| kgsec | `kubectl get secret` | Get secret for decoding | | kgsec | `kubectl get secret` | Get secret for decoding |
| kgseca | `kubectl get secret --all-namespaces` | List secrets across all namespaces |
| kdsec | `kubectl describe secret` | Describe secret resource in detail | | kdsec | `kubectl describe secret` | Describe secret resource in detail |
| kdelsec | `kubectl delete secret` | Delete the secret | | kdelsec | `kubectl delete secret` | Delete the secret |
| | | **Deployment management** | | | | **Deployment management** |
| kgd | `kubectl get deployment` | Get the deployment | | kgd | `kubectl get deployment` | Get the deployment |
| kgda | `kubectl get deployment --all-namespaces` | List deployments across all namespaces |
| kgdw | `kgd --watch` | After getting the deployment, watch for changes | | kgdw | `kgd --watch` | After getting the deployment, watch for changes |
| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information | | kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
| ked | `kubectl edit deployment` | Edit deployment resource from the default editor | | ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
@@ -91,7 +98,13 @@ plugins=(... kubectl)
| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces | | kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
| | | **Logs** | | | | **Logs** |
| kl | `kubectl logs` | Print the logs for a container or resource | | kl | `kubectl logs` | Print the logs for a container or resource |
| kl1h | `kubectl logs --since 1h` | Print logs from the last hour for a container or resource |
| kl1m | `kubectl logs --since 1m` | Print logs from the last minute for a container or resource |
| kl1s | `kubectl logs --since 1s` | Print logs from the last second for a container or resource |
| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) | | klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
| klf1h | `kubectl logs --since 1h -f` | Stream logs from the last hour for a container or resource (follow) |
| klf1m | `kubectl logs --since 1m -f` | Stream logs from the last minute for a container or resource (follow) |
| klf1s | `kubectl logs --since 1s -f` | Stream logs from the last second for a container or resource (follow) |
| | | **File copy** | | | | **File copy** |
| kcp | `kubectl cp` | Copy files and directories to and from containers | | kcp | `kubectl cp` | Copy files and directories to and from containers |
| | | **Node management** | | | | **Node management** |
@@ -102,12 +115,14 @@ plugins=(... kubectl)
| kdelno | `kubectl delete node` | Delete the node | | kdelno | `kubectl delete node` | Delete the node |
| | | **Persistent Volume Claim management** | | | | **Persistent Volume Claim management** |
| kgpvc | `kubectl get pvc` | List all PVCs | | kgpvc | `kubectl get pvc` | List all PVCs |
| kgpvca | `kubectl get pvc --all-namespaces` | List all PVCs across all namespaces |
| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes | | kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor | | kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
| kdpvc | `kubectl describe pvc` | Describe all pvcs | | kdpvc | `kubectl describe pvc` | Describe all pvcs |
| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments | | kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
| | | **StatefulSets management** | | | | **StatefulSets management** |
| kgss | `kubectl get statefulset` | List the statefulsets in ps format | | kgss | `kubectl get statefulset` | List the statefulsets in ps format |
| kgssa | `kubectl get statefulset --all-namespaces` | List statefulsets across all namespaces |
| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes | | kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
| kgsswide | `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information | | kgsswide | `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor | | kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
@@ -121,6 +136,7 @@ plugins=(... kubectl)
| kdelsa | `kubectl delete sa` | Delete the service account | | kdelsa | `kubectl delete sa` | Delete the service account |
| | | **DaemonSet management** | | | | **DaemonSet management** |
| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format | | kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
| kgdsa | `kubectl get daemonset --all-namespaces` | List all DaemonSets across all namespaces |
| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes | | kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor | | keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail | | kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
+6
View File
@@ -30,14 +30,20 @@ function tofu_version_prompt_info() {
alias tt='tofu' alias tt='tofu'
alias tta='tofu apply' alias tta='tofu apply'
alias tta!='tofu apply -auto-approve' alias tta!='tofu apply -auto-approve'
alias ttap='tofu apply -parallelism=1'
alias ttapp='tofu apply tfplan'
alias ttc='tofu console' alias ttc='tofu console'
alias ttd='tofu destroy' alias ttd='tofu destroy'
alias ttd!='tofu destroy -auto-approve' alias ttd!='tofu destroy -auto-approve'
alias ttf='tofu fmt' alias ttf='tofu fmt'
alias ttfr='tofu fmt -recursive' alias ttfr='tofu fmt -recursive'
alias tti='tofu init' alias tti='tofu init'
alias ttir='tofu init -reconfigure'
alias ttiu='tofu init -upgrade'
alias ttiur='tofu init -upgrade -reconfigure'
alias tto='tofu output' alias tto='tofu output'
alias ttp='tofu plan' alias ttp='tofu plan'
alias ttpo='tofu plan -out tfplan'
alias ttv='tofu validate' alias ttv='tofu validate'
alias tts='tofu state' alias tts='tofu state'
alias ttsh='tofu show' alias ttsh='tofu show'
+6 -1
View File
@@ -15,7 +15,12 @@ _togglePoetryShell() {
# Activate the environment if in a Poetry directory and no environment is currently active # Activate the environment if in a Poetry directory and no environment is currently active
if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then
venv_dir=$(poetry env info --path 2>/dev/null) venv_dir=$(poetry env info --path 2>/dev/null)
if [[ -n "$venv_dir" ]]; then # Handle case where poetry returns "." for in-project virtual environments
if [[ "$venv_dir" == "." ]]; then
venv_dir="$PWD/.venv"
fi
# Only proceed if venv_dir is set and the activate script exists
if [[ -n "$venv_dir" && -f "${venv_dir}/bin/activate" ]]; then
export poetry_active=1 export poetry_active=1
export poetry_dir="$PWD" export poetry_dir="$PWD"
source "${venv_dir}/bin/activate" source "${venv_dir}/bin/activate"
+6 -5
View File
@@ -4,21 +4,21 @@ function tf_prompt_info() {
# check if in terraform dir and file exists # check if in terraform dir and file exists
[[ -d "${TF_DATA_DIR:-.terraform}" && -r "${TF_DATA_DIR:-.terraform}/environment" ]] || return [[ -d "${TF_DATA_DIR:-.terraform}" && -r "${TF_DATA_DIR:-.terraform}/environment" ]] || return
local workspace="$(< "${TF_DATA_DIR:-.terraform}/environment")" local workspace="$(<"${TF_DATA_DIR:-.terraform}/environment")"
echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}" echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
} }
function tf_version_prompt_info() { function tf_version_prompt_info() {
local terraform_version local terraform_version
terraform_version=$(terraform --version | head -n 1 | cut -d ' ' -f 2) terraform_version=$(terraform --version | head -n 1 | cut -d ' ' -f 2)
echo "${ZSH_THEME_TF_VERSION_PROMPT_PREFIX-[}${terraform_version:gs/%/%%}${ZSH_THEME_TF_VERSION_PROMPT_SUFFIX-]}" echo "${ZSH_THEME_TF_VERSION_PROMPT_PREFIX-[}${terraform_version:gs/%/%%}${ZSH_THEME_TF_VERSION_PROMPT_SUFFIX-]}"
} }
alias tf='terraform' alias tf='terraform'
alias tfa='terraform apply' alias tfa='terraform apply'
alias tfa!='terraform apply -auto-approve' alias tfa!='terraform apply -auto-approve'
alias tfap='terraform apply -parallelism=1' alias tfap='terraform apply -parallelism=1'
alias tfapp='terraform apply tfplan'
alias tfc='terraform console' alias tfc='terraform console'
alias tfd='terraform destroy' alias tfd='terraform destroy'
alias tfd!='terraform destroy -auto-approve' alias tfd!='terraform destroy -auto-approve'
@@ -31,6 +31,7 @@ alias tfiu='terraform init -upgrade'
alias tfiur='terraform init -upgrade -reconfigure' alias tfiur='terraform init -upgrade -reconfigure'
alias tfo='terraform output' alias tfo='terraform output'
alias tfp='terraform plan' alias tfp='terraform plan'
alias tfpo='terraform plan -out tfplan'
alias tfv='terraform validate' alias tfv='terraform validate'
alias tfs='terraform state' alias tfs='terraform state'
alias tft='terraform test' alias tft='terraform test'
+2 -2
View File
@@ -87,8 +87,8 @@ _build_tmux_alias "tkss" "kill-session" "-t"
unfunction _build_tmux_alias unfunction _build_tmux_alias
# Determine if the terminal supports 256 colors # Determine if the terminal supports at least 256 colors
if [[ $terminfo[colors] == 256 ]]; then if (( ${+terminfo[colors]} )) && [[ $terminfo[colors] -ge 256 ]]; then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
else else
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2018-2025 Alexandros Kozak Copyright (c) 2018-2026 Alexandros Kozak
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+13 -17
View File
@@ -24,16 +24,18 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- [Case Sensitivity](#case-sensitivity) - [Case Sensitivity](#case-sensitivity)
- [`ZSHZ_UNCOMMON`](#zshz_uncommon) - [`ZSHZ_UNCOMMON`](#zshz_uncommon)
- [Making `--add` work for you](#making---add-work-for-you) - [Making `--add` work for you](#making---add-work-for-you)
- [Other Improvements and Fixes](#other-improvements-and-fixes) - [Other Improvements to the Original Functionality of `rupa/z`](#other-improvements-to-the-original-functionality-of-rupa-z)
- [Migrating from Other Tools](#migrating-from-other-tools) - [Migrating from Other Tools](#migrating-from-other-tools)
- [`COMPLETE_ALIASES`](#complete_aliases) - [`COMPLETE_ALIASES`](#complete_aliases)
- [Known Bugs](#known-bugs)
## News ## News
<details> <details>
<summary>Here are the latest features and updates.</summary> <summary>Here are the latest features and updates.</summary>
- March 31, 2026
+ When the user hits Tab after entering a command-line argument that uses spaces as wildcards (e.g., `z us lo bi`), the command line is clear of detritus (i.e., it looks like `z /usr/local/bin` instead of `z us lo /usr/local/bin`).
+ Improved test for Docker containers.
- August 24, 2023 - August 24, 2023
+ Zsh-z will now run when `setopt NO_UNSET` has been enabled (props @ntninja). + Zsh-z will now run when `setopt NO_UNSET` has been enabled (props @ntninja).
- August 23, 2023 - August 23, 2023
@@ -50,7 +52,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
+ A bug was fixed which was preventing paths with spaces in them from being updated ([#61](https://github.com/agkozak/zsh-z/issues/61)). + A bug was fixed which was preventing paths with spaces in them from being updated ([#61](https://github.com/agkozak/zsh-z/issues/61)).
+ If writing to the temporary database file fails, the database will not be clobbered (props @mafredri). + If writing to the temporary database file fails, the database will not be clobbered (props @mafredri).
- December 19, 2021 - December 19, 2021
+ ZSH-z will now display tildes for `HOME` during completion when `ZSHZ_TILDE=1` has been set. + Zsh-z will now display tildes for `HOME` during completion when `ZSHZ_TILDE=1` has been set.
- November 11, 2021 - November 11, 2021
+ A bug was fixed which was preventing ranks from being incremented. + A bug was fixed which was preventing ranks from being incremented.
+ `--add` has been made to work with relative paths and has been documented for the user. + `--add` has been made to work with relative paths and has been documented for the user.
@@ -71,7 +73,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- July 29, 2021 - July 29, 2021
+ Temporarily disabling the use of `print -v`, which was mangling CJK multibyte strings. + Temporarily disabling the use of `print -v`, which was mangling CJK multibyte strings.
- July 27, 2021 - July 27, 2021
+ Internal escaping of path names now works with older versions of ZSH. + Internal escaping of path names now works with older versions of Zsh.
+ Zsh-z now detects and discards any incomplete or incorrectly formatted database entries. + Zsh-z now detects and discards any incomplete or incorrectly formatted database entries.
- July 10, 2021 - July 10, 2021
+ Setting `ZSHZ_TRAILING_SLASH=1` makes it so that a search pattern ending in `/` can match the end of a path; e.g. `z foo/` can match `/path/to/foo`. + Setting `ZSHZ_TRAILING_SLASH=1` makes it so that a search pattern ending in `/` can match the end of a path; e.g. `z foo/` can match `/path/to/foo`.
@@ -79,12 +81,12 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
+ Setting `ZSHZ_TILDE=1` displays the `HOME` directory as `~`. + Setting `ZSHZ_TILDE=1` displays the `HOME` directory as `~`.
- May 7, 2021 - May 7, 2021
+ Setting `ZSHZ_ECHO=1` will cause Zsh-z to display the new path when you change directories. + Setting `ZSHZ_ECHO=1` will cause Zsh-z to display the new path when you change directories.
+ Better escaping of path names to deal paths containing the characters ``\`()[]``. + Better escaping of path names to deal with paths containing the characters ``\`()[]``.
- February 15, 2021 - February 15, 2021
+ Ranks are displayed the way `rupa/z` now displays them, i.e. as large integers. This should help Zsh-z to integrate with other tools. + Ranks are displayed the way `rupa/z` now displays them, i.e. as large integers. This should help Zsh-z to integrate with other tools.
- January 31, 2021 - January 31, 2021
+ Zsh-z is now efficient enough that, on MSYS2 and Cygwin, it is faster to run it in the foreground than it is to fork a subshell for it. + Zsh-z is now efficient enough that, on MSYS2 and Cygwin, it is faster to run it in the foreground than it is to fork a subshell for it.
+ `_zshz_precmd` simply returns if `PWD` is `HOME` or in `ZSH_EXCLUDE_DIRS`, rather than waiting for `zshz` to do that. + `_zshz_precmd` simply returns if `PWD` is `HOME` or in `ZSHZ_EXCLUDE_DIRS`, rather than waiting for `zshz` to do that.
- January 17, 2021 - January 17, 2021
+ Made sure that the `PUSHD_IGNORE_DUPS` option is respected. + Made sure that the `PUSHD_IGNORE_DUPS` option is respected.
- January 14, 2021 - January 14, 2021
@@ -171,7 +173,7 @@ is uncommented. Then find the section that specifies which modules are to be loa
'completion' \ 'completion' \
'prompt' 'prompt'
Add a backslash to the end of the last line add `'zsh-z'` to the list, e.g., Add a backslash to the end of the last line and add `'zsh-z'` to the list, e.g.,
zstyle ':prezto:load' pmodule \ zstyle ':prezto:load' pmodule \
'environment' \ 'environment' \
@@ -279,7 +281,7 @@ Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its be
* `ZSHZ_OWNER` allows usage when in `sudo -s` mode (default: empty) * `ZSHZ_OWNER` allows usage when in `sudo -s` mode (default: empty)
* `ZSHZ_TILDE` displays the name of the `HOME` directory as a `~` (default: `0`) * `ZSHZ_TILDE` displays the name of the `HOME` directory as a `~` (default: `0`)
* `ZSHZ_TRAILING_SLASH` makes it so that a search pattern ending in `/` can match the final element in a path; e.g., `z foo/` can match `/path/to/foo` (default: `0`) * `ZSHZ_TRAILING_SLASH` makes it so that a search pattern ending in `/` can match the final element in a path; e.g., `z foo/` can match `/path/to/foo` (default: `0`)
* `ZSHZ_UNCOMMON` changes the logic used to calculate the directory jumped to; [see below](#zshz_uncommon`) (default: `0`) * `ZSHZ_UNCOMMON` changes the logic used to calculate the directory jumped to; [see below](#zshz_uncommon) (default: `0`)
## Case sensitivity ## Case sensitivity
@@ -324,7 +326,7 @@ A good example might involve a directory tree that has Git repositories within i
(As a Zsh user, I tend to use `**` instead of `find`, but it is good to see how deep your directory trees go before doing that.) (As a Zsh user, I tend to use `**` instead of `find`, but it is good to see how deep your directory trees go before doing that.)
## Other Improvements and Fixes ## Other Improvements to the Original Functionality of `rupa/z`
* `z -x` works, with the help of `chpwd_functions`. * `z -x` works, with the help of `chpwd_functions`.
* Zsh-z is compatible with Solaris. * Zsh-z is compatible with Solaris.
@@ -336,6 +338,7 @@ A good example might involve a directory tree that has Git repositories within i
* Completions now work with options `-c`, `-r`, and `-t`. * Completions now work with options `-c`, `-r`, and `-t`.
* If `~/foo` and `~/foob` are matches, `~/foo` is no longer considered the common root. Only a common parent directory can be a common root. * If `~/foo` and `~/foob` are matches, `~/foo` is no longer considered the common root. Only a common parent directory can be a common root.
* `z -x` and the new, recursive `z -xR` can now accept an argument so that you can remove directories other than `PWD` from the database. * `z -x` and the new, recursive `z -xR` can now accept an argument so that you can remove directories other than `PWD` from the database.
* Zsh-z inherits `rupa/z`'s behavior of allowing spaces as wildcards (e.g., `z us lo bi` might take you to `/usr/local/bin`), but now completion of such command lines does not result in visual detritus.
## Migrating from Other Tools ## Migrating from Other Tools
@@ -347,7 +350,7 @@ If you are coming to Zsh-z (or even to the original `rupa/z`, for that matter) f
## `COMPLETE_ALIASES` ## `COMPLETE_ALIASES`
`z`, or any alternative you set up using `$ZSH_CMD` or `$_Z_CMD`, is an alias. `setopt COMPLETE_ALIASES` divorces the tab completion for aliases from the underlying commands they invoke, so if you enable `COMPLETE_ALIASES`, tab completion for Zsh-z will be broken. You can get it working again, however, by adding under `z`, or any alternative you set up using `$ZSHZ_CMD` or `$_Z_CMD`, is an alias. `setopt COMPLETE_ALIASES` divorces the tab completion for aliases from the underlying commands they invoke, so if you enable `COMPLETE_ALIASES`, tab completion for Zsh-z will be broken. You can get it working again, however, by adding under
setopt COMPLETE_ALIASES setopt COMPLETE_ALIASES
@@ -356,10 +359,3 @@ the line
compdef _zshz ${ZSHZ_CMD:-${_Z_CMD:-z}} compdef _zshz ${ZSHZ_CMD:-${_Z_CMD:-z}}
That will re-bind `z` or the command of your choice to the underlying Zsh-z function. That will re-bind `z` or the command of your choice to the underlying Zsh-z function.
## Known Bug
It is possible to run a completion on a string with spaces in it, e.g., `z us bi<TAB>` might take you to `/usr/local/bin`. This works, but as things stand, after the completion the command line reads
z us /usr/local/bin.
You get where you want to go, but the detritus on the command line is annoying. This is also a problem in `rupa/z`, but I am keen on eventually eliminating this glitch. Advice is welcome.
+2 -17
View File
@@ -5,7 +5,7 @@
# #
# https://github.com/agkozak/zsh-z # https://github.com/agkozak/zsh-z
# #
# Copyright (c) 2018-2023 Alexandros Kozak # Copyright (c) 2018-2026 Alexandros Kozak
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -37,25 +37,10 @@ emulate -L zsh
(( ZSHZ_DEBUG )) && (( ZSHZ_DEBUG )) &&
setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL NO_WARN_NESTED_VAR 2> /dev/null setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL NO_WARN_NESTED_VAR 2> /dev/null
# TODO: This routine currently reproduces z's feature of allowing spaces to be
# used as wildcards in completions, so that
#
# z us lo bi
#
# can expand to
#
# z /usr/local/bin
#
# but it also reproduces z's buggy display on the commandline, viz.
#
# z us lo /usr/local/bin
#
# Address.
local completions expl completion local completions expl completion
local -a completion_list local -a completion_list
completions=$(zshz --complete ${(@)words:1}) completions=$(zshz --complete "${(@)words:1}")
[[ -z $completions ]] && return 1 [[ -z $completions ]] && return 1
for completion in ${(f)completions[@]}; do for completion in ${(f)completions[@]}; do
+71 -4
View File
@@ -4,7 +4,7 @@
# #
# https://github.com/agkozak/zsh-z # https://github.com/agkozak/zsh-z
# #
# Copyright (c) 2018-2025 Alexandros Kozak # Copyright (c) 2018-2026 Alexandros Kozak
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -294,9 +294,9 @@ zshz() {
owner=${ZSHZ_OWNER:-${_Z_OWNER}} owner=${ZSHZ_OWNER:-${_Z_OWNER}}
if (( ZSHZ[USE_FLOCK] )); then if (( ZSHZ[USE_FLOCK] )); then
# An unsual case: if inside Docker container where datafile could be bind # An unusual case: if inside Docker container where datafile could be bind
# mounted # mounted
if [[ -r '/proc/1/cgroup' && "$(< '/proc/1/cgroup')" == *docker* ]]; then if [[ -f '/.dockerenv' || ( -r '/proc/1/cgroup' && "$(< '/proc/1/cgroup')" == *docker* ) ]]; then
print "$(< "$tempfile")" > "$datafile" 2> /dev/null print "$(< "$tempfile")" > "$datafile" 2> /dev/null
${ZSHZ[RM]} -f "$tempfile" ${ZSHZ[RM]} -f "$tempfile"
# All other cases # All other cases
@@ -960,6 +960,62 @@ add-zsh-hook chpwd _zshz_chpwd
(( ${fpath[(ie)${0:A:h}]} <= ${#fpath} )) || fpath=( "${0:A:h}" "${fpath[@]}" ) (( ${fpath[(ie)${0:A:h}]} <= ${#fpath} )) || fpath=( "${0:A:h}" "${fpath[@]}" )
# Save the existing Tab binding
ZSHZ[TAB_BINDING]="${$(bindkey -M main '^I')##* }"
############################################################
# ZLE widget to fix spaces-as-wildcards completion
#
# When completing a Zsh-z command with multiple search terms
# (e.g. `z us lo bi'), collapse the terms into a single
# wildcard-joined word (e.g. `z us*lo*bi') before triggering
# completion. This causes compadd to replace the whole query
# with the matched path rather than just the last word.
#
# Globals:
# ZSHZ_CMD
############################################################
_zshz_zle_completion_widget() {
emulate -L zsh
local cmd=${ZSHZ_CMD:-${_Z_CMD:-z}}
# If a trailing space was added after an already-completed absolute path
# (e.g. `z /usr/local/bin '), a second Tab would otherwise re-trigger
# completion on an empty word and insert a duplicate. Bail out early.
if [[ $LBUFFER[-1] == ' ' && ${${LBUFFER% }##* } == [/~]* ]]; then
return
fi
# Only act when there are at least two words after the command
if [[ $LBUFFER == ${cmd}\ *\ * ]]; then
local after=${LBUFFER#${cmd} }
local -a parts flag_parts search_parts
local p past_flags=0
parts=( ${(z)after} )
for p in $parts; do
if (( ! past_flags )) && [[ $p == -[cehlrRtx]## ]]; then
flag_parts+=( $p )
else
past_flags=1
search_parts+=( $p )
fi
done
if (( ${#search_parts} > 1 )); then
LBUFFER="${cmd}${flag_parts:+ ${(j: :)flag_parts}} ${(j:*:)search_parts}"
fi
fi
# If Tab had a non-default binding, continue to use it; otherwise the default
# expand-or-complete gets used.
zle ${ZSHZ[TAB_BINDING]:-expand-or-complete}
}
zle -N _zshz_zle_completion_widget
bindkey -M main '^I' _zshz_zle_completion_widget
############################################################ ############################################################
# zsh-z functions # zsh-z functions
############################################################ ############################################################
@@ -974,7 +1030,8 @@ ZSHZ[FUNCTIONS]='_zshz_usage
zshz zshz
_zshz_precmd _zshz_precmd
_zshz_chpwd _zshz_chpwd
_zshz' _zshz
_zshz_zle_completion_widget'
############################################################ ############################################################
# Enable WARN_NESTED_VAR for functions listed in # Enable WARN_NESTED_VAR for functions listed in
@@ -1004,6 +1061,16 @@ zsh-z_plugin_unload() {
add-zsh-hook -D precmd _zshz_precmd add-zsh-hook -D precmd _zshz_precmd
add-zsh-hook -d chpwd _zshz_chpwd add-zsh-hook -d chpwd _zshz_chpwd
zle -D _zshz_zle_completion_widget
# Only restore Tab binding if it is still bound to our widget; otherwise
# leave it alone.
local _zshz_current_tab
_zshz_current_tab="$(bindkey -M main '^I' 2>/dev/null || true)"
if [[ ${_zshz_current_tab##* } == _zshz_zle_completion_widget ]]; then
bindkey -M main '^I' "${ZSHZ[TAB_BINDING]:-expand-or-complete}"
fi
local x local x
for x in ${=ZSHZ[FUNCTIONS]}; do for x in ${=ZSHZ[FUNCTIONS]}; do
(( ${+functions[$x]} )) && unfunction $x (( ${+functions[$x]} )) && unfunction $x