From d6ba2a78b901c26872a4dac15ac962a5a65e9549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Fri, 4 Apr 2025 02:19:07 +0200 Subject: [PATCH] tmux: bind tmux-session-menu --- tmux/.tmux.conf | 4 +++- tmux/bin/tmux-session-menu | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 tmux/bin/tmux-session-menu diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index be2b861..d273c94 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -12,7 +12,7 @@ bind-key -n M-6 select-window -t 6 bind-key -n M-7 select-window -t 7 bind-key -n M-8 select-window -t 8 bind-key -n M-9 select-window -t 9 -bind-key -n M-0 select-window -t 10 +#bind-key -n M-0 select-window -t 10 bind-key -n M-! swap-window -t 1 bind-key -n M-@ swap-window -t 2 @@ -83,3 +83,5 @@ bind-key -T copy-mode-vi C-M-h swap-pane -s "{left-of}" bind-key -T copy-mode-vi C-M-j swap-pane -s "{down-of}" bind-key -T copy-mode-vi C-M-k swap-pane -s "{up-of}" bind-key -T copy-mode-vi C-M-l swap-pane -s "{right-of}" + +bind-key -n M-0 run-shell tmux-session-menu diff --git a/tmux/bin/tmux-session-menu b/tmux/bin/tmux-session-menu new file mode 100755 index 0000000..b318add --- /dev/null +++ b/tmux/bin/tmux-session-menu @@ -0,0 +1,5 @@ +#!/bin/sh + +tmux list-sessions -F '#S' \ +| awk 'BEGIN {ORS=" "; print "toggle t \"switch-client -l\""} {print $1, NR, "\"switch-client -t", $1 "\""}' \ +| xargs tmux display-menu -T "Switch session"