From 19ef8649c13d5e4c0649dd0625bb8abb23f69832 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 17 Apr 2026 10:53:42 +0100 Subject: feat: auto-rename zellij tabs as dir:cmd (tmux-style) Uses precmd/preexec hooks to rename the active zellij tab: - At prompt: shows directory name (e.g. 'dotfiles') - During command: shows dir:cmd (e.g. 'dotfiles:nvim') Only active inside zellij ($ZELLIJ is set). --- home/.config/zsh/.zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index f22e5f2..7cb2484 100644 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -143,6 +143,18 @@ if [[ "$TERM" == (alacritty|st*|screen*|xterm*|rxvt*|tmux*|putty*|konsole*|gnome add-zsh-hook -Uz preexec xterm_title_preexec fi +# ── Zellij tab naming (dir:cmd like tmux) ──────────────────────────────────── +if [[ -n "$ZELLIJ" ]]; then + _zellij_tab_precmd() { + zellij action rename-tab "${PWD##*/}" 2>/dev/null + } + _zellij_tab_preexec() { + zellij action rename-tab "${PWD##*/}:${1%% *}" 2>/dev/null + } + add-zsh-hook precmd _zellij_tab_precmd + add-zsh-hook preexec _zellij_tab_preexec +fi + # ── Recent directories ──────────────────────────────────────────────────────── autoload -Uz chpwd_recent_dirs cdr add-zsh-hook chpwd chpwd_recent_dirs -- cgit v1.2.3-70-g09d2