From 0f061a2d0d3268ae9aa6c295905422ae46c01883 Mon Sep 17 00:00:00 2001 From: hobe Date: Wed, 25 Mar 2026 13:44:14 +0900 Subject: [PATCH] feat(zellij): add help function to list registered aliases Type `zjh` (or `zh` with z prefix) to print a quick-reference table. Only aliases and functions that were actually registered are shown, so conflicts with other plugins are reflected accurately. --- plugins/zellij/README.md | 4 ++++ plugins/zellij/zellij.plugin.zsh | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/plugins/zellij/README.md b/plugins/zellij/README.md index 2828466a5..c6e9af24e 100644 --- a/plugins/zellij/README.md +++ b/plugins/zellij/README.md @@ -58,6 +58,10 @@ The following convenience functions are always available (unless the name is alr | `zrf` | `zellij run --floating --` | Run a command in a floating pane | | `ze` | `zellij edit` | Edit a file in a pane | +## Help + +Type `zjh` (or `zh` with `z` prefix) to see a summary of all available aliases and functions. + ## Completions This plugin caches the zellij completion script. On first load the cache is generated diff --git a/plugins/zellij/zellij.plugin.zsh b/plugins/zellij/zellij.plugin.zsh index 68b599008..46ae04e15 100644 --- a/plugins/zellij/zellij.plugin.zsh +++ b/plugins/zellij/zellij.plugin.zsh @@ -83,6 +83,35 @@ fi (( $+functions[zrf] || $+aliases[zrf] || $+commands[zrf] )) || zrf() { command zellij run --floating -- "$@"; } (( $+functions[ze] || $+aliases[ze] || $+commands[ze] )) || ze() { command zellij edit "$@"; } +if ! _omz_zellij_taken "${_zellij_short_prefix}h"; then + eval "${_zellij_short_prefix}h() { + printf '\\e[1mzellij plugin aliases\\e[0m\\n' + local -a _entries=( + '${_zellij_root_alias}:zellij' + '${_zellij_short_prefix}l:zellij list-sessions' + '${_zellij_short_prefix}s:zellij -s ' + '${_zellij_short_prefix}a:zellij attach ' + '${_zellij_short_prefix}d:zellij delete-session ' + '${_zellij_short_prefix}k:zellij kill-session ' + '${_zellij_short_prefix}da:zellij delete-all-sessions' + '${_zellij_short_prefix}ka:zellij kill-all-sessions' + '${_zellij_short_prefix}ad:zellij action detach' + '${_zellij_short_prefix}as:zellij action switch-session ' + '${_zellij_short_prefix}r:zellij run' + 'zr:zellij run -- ' + 'zrf:zellij run --floating -- ' + 'ze:zellij edit ' + '${_zellij_short_prefix}h:Show this help' + ) + local entry name cmd + for entry in \"\${_entries[@]}\"; do + name=\"\${entry%%:*}\" + cmd=\"\${entry#*:}\" + (( \$+aliases[\$name] || \$+functions[\$name] )) && printf ' %-8s %s\\n' \"\$name\" \"\$cmd\" + done + }" +fi + _ZELLIJ_COMP_DIR="${ZSH_CACHE_DIR}/completions" _ZELLIJ_COMP_FILE="${_ZELLIJ_COMP_DIR}/_zellij"