From 0fe2b5ab9a47e55c7e454052991e1087aad58654 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Fri, 17 Apr 2026 16:42:28 +0200 Subject: [PATCH] zellij: fix stale ssh env, auto tab names, hx scrollback --- files/shell/.shellrc.alias | 5 +++++ files/shell/.zshrc | 12 ++++++++++++ files/zellij/.config/zellij/config.kdl | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/files/shell/.shellrc.alias b/files/shell/.shellrc.alias index 2dcfb44..17d4e44 100644 --- a/files/shell/.shellrc.alias +++ b/files/shell/.shellrc.alias @@ -41,6 +41,11 @@ t() { tmux new-session -A -s ${1:-tmux} } z() { + # if remote, link agent so a stale zellij env doesn't hurt agent + if [[ $SSH_AUTH_SOCK =~ ^"/tmp/ssh-" ]]; then + ln -sf $SSH_AUTH_SOCK /tmp/agent.sock + export SSH_AUTH_SOCK=/tmp/agent.sock + fi zellij attach ${1:-$HOST} 2> /dev/null || zellij -s ${1:-$HOST} } diff --git a/files/shell/.zshrc b/files/shell/.zshrc index e42e10a..2f7055f 100644 --- a/files/shell/.zshrc +++ b/files/shell/.zshrc @@ -29,3 +29,15 @@ source $ZSH/oh-my-zsh.sh [ -f ~/.shellrc.alias ] && source ~/.shellrc.alias [ -f ~/.shellrc.local ] && source ~/.shellrc.local + +function set_zellij_tab_to_working_dir() { + local current_dir=$PWD + if [[ $current_dir == $HOME ]]; then + current_dir="~" + else + current_dir=${current_dir##*/} + fi + command nohup zellij action rename-tab $current_dir >/dev/null 2>&1 +} + +[[ -n $ZELLIJ ]] && add-zsh-hook precmd set_zellij_tab_to_working_dir diff --git a/files/zellij/.config/zellij/config.kdl b/files/zellij/.config/zellij/config.kdl index 79abc92..0bc37d4 100644 --- a/files/zellij/.config/zellij/config.kdl +++ b/files/zellij/.config/zellij/config.kdl @@ -403,7 +403,7 @@ default_layout "compact" // Path to the default editor to use to edit pane scrollbuffer // Default: $EDITOR or $VISUAL -// scrollback_editor "/usr/bin/vim" +scrollback_editor "hx" // A fixed name to always give the Zellij session. // Consider also setting `attach_to_session true,`