mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
tmux: use builtin switch to last session
lol I reinvented the wheel
This commit is contained in:
parent
3f46bd7c81
commit
38b704da0e
3 changed files with 3 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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; [
|
||||
|
|
|
|||
|
|
@ -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
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue