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.
This commit is contained in:
hobe 2026-03-25 13:44:14 +09:00
commit 0f061a2d0d
2 changed files with 33 additions and 0 deletions

View file

@ -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 | | `zrf` | `zellij run --floating --` | Run a command in a floating pane |
| `ze` | `zellij edit` | Edit a file in a 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 ## Completions
This plugin caches the zellij completion script. On first load the cache is generated This plugin caches the zellij completion script. On first load the cache is generated

View file

@ -83,6 +83,35 @@ fi
(( $+functions[zrf] || $+aliases[zrf] || $+commands[zrf] )) || zrf() { command zellij run --floating -- "$@"; } (( $+functions[zrf] || $+aliases[zrf] || $+commands[zrf] )) || zrf() { command zellij run --floating -- "$@"; }
(( $+functions[ze] || $+aliases[ze] || $+commands[ze] )) || ze() { command zellij edit "$@"; } (( $+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 <name>'
'${_zellij_short_prefix}a:zellij attach <session>'
'${_zellij_short_prefix}d:zellij delete-session <session>'
'${_zellij_short_prefix}k:zellij kill-session <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 <session>'
'${_zellij_short_prefix}r:zellij run'
'zr:zellij run -- <cmd>'
'zrf:zellij run --floating -- <cmd>'
'ze:zellij edit <file>'
'${_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_DIR="${ZSH_CACHE_DIR}/completions"
_ZELLIJ_COMP_FILE="${_ZELLIJ_COMP_DIR}/_zellij" _ZELLIJ_COMP_FILE="${_ZELLIJ_COMP_DIR}/_zellij"