diff options
Diffstat (limited to 'home/.config/zsh/.zshrc')
| -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' |
