aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <[email protected]>2026-04-17 10:53:42 +0100
committerLibravatar sommerfeld <[email protected]>2026-04-17 10:53:42 +0100
commit19ef8649c13d5e4c0649dd0625bb8abb23f69832 (patch)
tree63a72f9d6360d1d5f8c9107b4ce8cfa290794d60
parentf045790589e476537316e44225ce70b69e51a45c (diff)
downloaddotfiles-19ef8649c13d5e4c0649dd0625bb8abb23f69832.tar.gz
dotfiles-19ef8649c13d5e4c0649dd0625bb8abb23f69832.tar.bz2
dotfiles-19ef8649c13d5e4c0649dd0625bb8abb23f69832.zip
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).
-rw-r--r--home/.config/zsh/.zshrc12
1 files changed, 12 insertions, 0 deletions
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