diff options
| author | 2026-04-17 10:53:49 +0100 | |
|---|---|---|
| committer | 2026-04-17 10:53:49 +0100 | |
| commit | 6e2d153f675a1f498fcd06d03749d9a2c1a9bafd (patch) | |
| tree | 061e4e9ec9fb9256991ec55fd0cdb98da2953377 | |
| parent | 669e53e05638c493e299ec20e99214165897abae (diff) | |
| download | dotfiles-6e2d153f675a1f498fcd06d03749d9a2c1a9bafd.tar.gz dotfiles-6e2d153f675a1f498fcd06d03749d9a2c1a9bafd.tar.bz2 dotfiles-6e2d153f675a1f498fcd06d03749d9a2c1a9bafd.zip | |
fix: restore dynamic tab number prefix
The compact bar does not show tab numbers on its own, so the
prefix is needed. The index is queried dynamically via
current-tab-info on each prompt. Inactive tabs may briefly show
a stale number after a tab close but correct on focus.
| -rw-r--r-- | home/.config/zsh/.zshrc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index bc82f3d..22f70d6 100644 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -146,8 +146,9 @@ fi # ── Zellij tab naming (dir:cmd like tmux) ──────────────────────────────────── if [[ -n "$ZELLIJ" ]]; then _zellij_dir() { [[ "$PWD" == "$HOME" ]] && echo '~' || echo "${PWD##*/}"; } - _zellij_tab_precmd() { zellij action rename-tab "$(_zellij_dir)" 2>/dev/null; } - _zellij_tab_preexec() { zellij action rename-tab "$(_zellij_dir):${1%% *}" 2>/dev/null; } + _zellij_tab_idx() { echo $(( $(zellij action current-tab-info 2>/dev/null | grep -oP 'position: \K\d+') + 1 )); } + _zellij_tab_precmd() { zellij action rename-tab "$(_zellij_tab_idx):$(_zellij_dir)" 2>/dev/null; } + _zellij_tab_preexec() { zellij action rename-tab "$(_zellij_tab_idx):$(_zellij_dir):${1%% *}" 2>/dev/null; } add-zsh-hook precmd _zellij_tab_precmd add-zsh-hook preexec _zellij_tab_preexec fi |
