mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-03 04:20:01 +02:00
refactor(zellij): separate root alias from sub-command prefix
Split _zellij_root_alias and _zellij_short_prefix so that when z is taken (e.g. by zoxide), only the root alias falls back to zj while sub-commands keep the shorter z prefix (zl, za, zk, zd, …). Every alias and function now checks for conflicts before defining, and compdef targets are collected dynamically to avoid binding completions to names that were never created. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e564461958
commit
15fbdaab58
2 changed files with 102 additions and 43 deletions
|
|
@ -10,35 +10,43 @@ plugins=(... zellij)
|
|||
|
||||
## Dynamic prefix
|
||||
|
||||
The default alias prefix is `zj`. To use the shorter `z` prefix instead, set the following
|
||||
variable before oh-my-zsh is sourced:
|
||||
The default prefix is `zj`. To use the shorter `z` prefix instead, set the following variable
|
||||
before oh-my-zsh is sourced:
|
||||
|
||||
```zsh
|
||||
ZSH_ZELLIJ_PREFIX_Z=true
|
||||
```
|
||||
|
||||
> **Note:** If `z` is already defined as an alias, function, or command by another plugin
|
||||
> (e.g., zoxide), the `zj` prefix is used for the main `zellij` alias even when
|
||||
> `ZSH_ZELLIJ_PREFIX_Z` is set.
|
||||
When `ZSH_ZELLIJ_PREFIX_Z` is set, the root alias (`z`) and sub-command prefix are handled
|
||||
separately:
|
||||
|
||||
- If `z` is **not** taken → `z`=zellij, sub-commands use `z` prefix (`zl`, `za`, …)
|
||||
- If `z` **is** taken (e.g., by zoxide) → `zj`=zellij, but sub-commands still use `z` prefix (`zl`, `za`, …)
|
||||
|
||||
This means only the root alias falls back to `zj`; the shorter sub-command shortcuts remain
|
||||
usable.
|
||||
|
||||
All aliases and functions perform a conflict check before being defined — if a name is already
|
||||
taken by another alias, function, or command, it is silently skipped.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias (default) | Alias (with `z`) | Command | Description |
|
||||
| ---------------- | ---------------- | ---------------------------- | ------------------------ |
|
||||
| `zj` | `z` | `zellij` | Zellij command |
|
||||
| `zjl` | `zl` | `zellij list-sessions` | List sessions |
|
||||
| `zjs` | `zs` | `zellij -s` | Start a named session |
|
||||
| `zjda` | `zda` | `zellij delete-all-sessions` | Delete all sessions |
|
||||
| `zjka` | `zka` | `zellij kill-all-sessions` | Kill all sessions |
|
||||
| `zjr` | — | `zellij run` | Run a command in a pane |
|
||||
| Alias (default) | Alias (with `z`) | Alias (`z` + conflict) | Command | Description |
|
||||
| ---------------- | ---------------- | ---------------------- | ---------------------------- | ------------------------ |
|
||||
| `zj` | `z` | `zj` | `zellij` | Zellij command |
|
||||
| `zjl` | `zl` | `zl` | `zellij list-sessions` | List sessions |
|
||||
| `zjs` | `zs` | `zs` | `zellij -s` | Start a named session |
|
||||
| `zjda` | `zda` | `zda` | `zellij delete-all-sessions` | Delete all sessions |
|
||||
| `zjka` | `zka` | `zka` | `zellij kill-all-sessions` | Kill all sessions |
|
||||
| `zjr` | — | — | `zellij run` | Run a command in a pane |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function (default) | Function (with `z`) | Command | Description |
|
||||
| ------------------- | ------------------- | ------------------------------ | --------------------------------- |
|
||||
| `zja` | `za` | `zellij attach` | Attach to a session |
|
||||
| `zjd` | `zd` | `zellij delete-session` | Delete a session |
|
||||
| `zjk` | `zk` | `zellij kill-session` | Kill a session |
|
||||
| Function (default) | Function (with `z`) | Command | Description |
|
||||
| ------------------- | ------------------- | ------------------------ | -------------------- |
|
||||
| `zja` | `za` | `zellij attach` | Attach to a session |
|
||||
| `zjd` | `zd` | `zellij delete-session` | Delete a session |
|
||||
| `zjk` | `zk` | `zellij kill-session` | Kill a session |
|
||||
|
||||
The following convenience functions are always available (unless the name is already taken):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue