mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-10 04:26:17 +02:00
feat(zellij): add zellij plugin with aliases and completions
Add a new plugin for the zellij terminal multiplexer providing: - 9 shorthand aliases with dynamic prefix (z or zj to avoid conflicts) - Background completion caching using the same pattern as the gh plugin Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1e3abc123f
commit
c733b0af53
2 changed files with 69 additions and 0 deletions
35
plugins/zellij/zellij.plugin.zsh
Normal file
35
plugins/zellij/zellij.plugin.zsh
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
if (( ! $+commands[zellij] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# Dynamic prefix: use "z" if no conflict, fall back to "zj"
|
||||
if (( $+aliases[z] )); then
|
||||
_zellij_prefix="zj"
|
||||
else
|
||||
_zellij_prefix="z"
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
alias ${_zellij_prefix}='zellij'
|
||||
alias ${_zellij_prefix}a='zellij attach'
|
||||
alias ${_zellij_prefix}d='zellij delete-session'
|
||||
alias ${_zellij_prefix}da='zellij delete-all-sessions'
|
||||
alias ${_zellij_prefix}k='zellij kill-session'
|
||||
alias ${_zellij_prefix}ka='zellij kill-all-sessions'
|
||||
alias ${_zellij_prefix}l='zellij list-sessions'
|
||||
alias ${_zellij_prefix}r='zellij run'
|
||||
alias ${_zellij_prefix}s='zellij -s'
|
||||
|
||||
unset _zellij_prefix
|
||||
|
||||
# Completion caching (same pattern as gh plugin)
|
||||
# On first load, _zellij may not exist in fpath — autoload fails silently.
|
||||
# The background command generates the cache file for subsequent sessions.
|
||||
# Load order: plugin loads → compinit runs → next session picks up cached file.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_zellij" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _zellij
|
||||
_comps[zellij]=_zellij
|
||||
fi
|
||||
|
||||
zellij setup --generate-completion zsh >| "$ZSH_CACHE_DIR/completions/_zellij" &|
|
||||
Loading…
Add table
Add a link
Reference in a new issue