From 38b704da0e5526419a4c52309ce21a315a19ad24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 16 Jul 2025 21:06:01 +0200 Subject: [PATCH] tmux: use builtin switch to last session lol I reinvented the wheel --- nix/homeModules/common/tmux/tmux.conf | 3 +++ .../extra/tmux-fish-integration.nix | 1 - .../by-name/tmux-sessionizer/package.nix | 23 ------------------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/nix/homeModules/common/tmux/tmux.conf b/nix/homeModules/common/tmux/tmux.conf index 19769ed0..b642ec16 100644 --- a/nix/homeModules/common/tmux/tmux.conf +++ b/nix/homeModules/common/tmux/tmux.conf @@ -72,6 +72,9 @@ bind -T copy-mode-vi C-t select-window -t 2 bind -T copy-mode-vi C-n select-window -t 3 bind -T copy-mode-vi C-s select-window -t 4 +# easier to hit than L +bind l switch-client -l + # CLOK bind C-t clock-mode set -g clock-mode-style 24 diff --git a/nix/homeModules/extra/tmux-fish-integration.nix b/nix/homeModules/extra/tmux-fish-integration.nix index 35696a20..37061609 100644 --- a/nix/homeModules/extra/tmux-fish-integration.nix +++ b/nix/homeModules/extra/tmux-fish-integration.nix @@ -26,7 +26,6 @@ programs.tmux.extraConfig = lib.mkBefore '' # sessionizer binds bind -n C-f run-shell "tmux new-window tmux-sessionizer" - bind l run-shell "tmux-last" ''; home.packages = with pkgs; [ diff --git a/nix/packages/by-name/tmux-sessionizer/package.nix b/nix/packages/by-name/tmux-sessionizer/package.nix index c00e3747..e60e8a45 100644 --- a/nix/packages/by-name/tmux-sessionizer/package.nix +++ b/nix/packages/by-name/tmux-sessionizer/package.nix @@ -53,28 +53,6 @@ ''; }; - tmux-last = writeShellApplication { - name = "tmux-last"; - text = '' - tmux_last=/tmp/TMUX_LAST - if [ ! -f $tmux_last ]; then - echo "Last session is not yet set" - return 1 - fi - - session_name="$(cat $tmux_last)" - session_path="$session_name" - if [ ! -d "$session_path" ]; then - session_path="/tmp" - fi - - # bail if not in tmux, nothing to register - ${lib.getExe tmux-register-session} || : - ${lib.getExe tmux-maybe-create} "$session_name" "$session_path" - ${lib.getExe tmux-attach-or-switch} "$session_name" - ''; - }; - tmux-sessionizer = writeShellApplication { name = "tmux-sessionizer"; runtimeInputs = [fzf gnused]; @@ -121,7 +99,6 @@ in tmux-register-session tmux-maybe-create tmux-attach-or-switch - tmux-last tmux-sessionizer ]; }