diff options
| author | 2026-04-17 10:53:41 +0100 | |
|---|---|---|
| committer | 2026-04-17 10:53:41 +0100 | |
| commit | f045790589e476537316e44225ce70b69e51a45c (patch) | |
| tree | 86b6dd93af3351ca1552bb7cb7c7d1dc4ce2cbea | |
| parent | 14fa6dfcd18b0c36e64e1b8df204201952bd5794 (diff) | |
| download | dotfiles-f045790589e476537316e44225ce70b69e51a45c.tar.gz dotfiles-f045790589e476537316e44225ce70b69e51a45c.tar.bz2 dotfiles-f045790589e476537316e44225ce70b69e51a45c.zip | |
fix: make za smart-attach (create/attach/pick based on session count)
0 sessions: create new. 1 session: attach directly. Multiple: open
the welcome picker. Replaces broken 'zellij attach -c' which required
a session name argument.
| -rw-r--r-- | home/.config/zsh/.zshrc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index a05bbc8..f22e5f2 100644 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -219,8 +219,17 @@ alias nview='nvim -R' alias nv='nvim -R' alias ng='nvim +Neogit' -# Zellij: attach to session or create if it doesn't exist (name is optional) -alias za='zellij attach -c' +# Zellij: smart attach — 0 sessions: create, 1: attach, many: welcome picker +za() { + local sessions=$(zellij list-sessions -ns 2>/dev/null | wc -l) + if (( sessions == 0 )); then + zellij + elif (( sessions == 1 )); then + zellij attach + else + zellij -l welcome + fi +} # Just alias j='just' |
