aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.config/zsh/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'home/.config/zsh/.zshrc')
-rw-r--r--home/.config/zsh/.zshrc6
1 files changed, 4 insertions, 2 deletions
diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc
index 746c5b0..18aa3e6 100644
--- a/home/.config/zsh/.zshrc
+++ b/home/.config/zsh/.zshrc
@@ -146,8 +146,10 @@ 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=$(zellij action current-tab-info 2>/dev/null | grep -oP 'position: \K\d+')
+ (( _zellij_tab_idx++ )) # 0-indexed → 1-indexed
+ _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