From 033425f8690b9872a942d10a67754af49abc5f35 Mon Sep 17 00:00:00 2001 From: thek4n Date: Mon, 21 Oct 2024 12:40:22 +0300 Subject: [PATCH] tmux mapping choose session fix --- home/user/.local/bin/tmux_choose_session.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/home/user/.local/bin/tmux_choose_session.sh b/home/user/.local/bin/tmux_choose_session.sh index eb65bdc..1877a0b 100755 --- a/home/user/.local/bin/tmux_choose_session.sh +++ b/home/user/.local/bin/tmux_choose_session.sh @@ -17,13 +17,18 @@ tab:replace-query,\ shift-tab:toggle\ " +declare current_session +current_session="$(tmux display-message -p '#S')" +readonly current_session + declare sessions -sessions="$(tmux list-session -F '#S')" +sessions="$(tmux list-session -F '#S#{?session_attached, (attached),}')" +sessions="$(echo "${sessions}" | sed "s/^${current_session} /${current_session} (current) /")" readonly sessions declare session -session="$(echo "${sessions}" | fzf +m --preview-window 75%,follow --preview 'tmux capture-pane -p -e -t {1}')" +session="$(echo "${sessions}" | fzf +m --preview-window 75%,follow --preview 'tmux capture-pane -p -e -t {1}' | awk '{printf $1}')" readonly session if [[ -n "${session}" ]]; then