diff --git a/config/tmux/sesh-tmux.fish b/config/tmux/sesh-tmux.fish new file mode 100755 index 0000000..0e75aac --- /dev/null +++ b/config/tmux/sesh-tmux.fish @@ -0,0 +1,18 @@ +#!/usr/bin/env fish + +set selection (sesh list --icons | fzf-tmux -p 80%,70% \ + --no-sort --ansi --border-label ' sesh ' --prompt '⚡ ' \ + --header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \ + --bind 'tab:down,btab:up' \ + --bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \ + --bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --icons)' \ + --bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \ + --bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \ + --bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \ + --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \ + --preview-window 'right:55%' \ + --preview 'sesh preview {}') + +if test -n "$selection" + sesh connect "$selection" +end diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf index c530532..d06d3d7 100644 --- a/config/tmux/tmux.conf +++ b/config/tmux/tmux.conf @@ -103,32 +103,16 @@ unbind p bind p paste-buffer # tms bindings -bind -N "tms" t display-popup -E "tms" +bind -N "tms" T display-popup -E "tms" bind -N "tms windows" C-w display-popup -E "tms windows" bind -N "tms switch" C-s display-popup -E "tms switch" bind -N "tms refresh" C-r display-popup -E "tms refresh" # global sessions # bind-key "K" display-popup -h 90% -w 50% -E "sesh ui" -bind-key "K" run-shell "sesh connect \"$( - sesh list --icons --hide-duplicates | fzf-tmux -p 100%,100% --no-border \ - --list-border \ - --no-sort --prompt '⚡ ' \ - --input-border \ - --header-border \ - --bind 'tab:down,btab:up' \ - --bind 'ctrl-b:abort' \ - --bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \ - --bind 'ctrl-t:change-prompt( )+reload(sesh list -t --icons)' \ - --bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \ - --bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \ - --bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \ - --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \ - --preview-window 'right:70%' \ - --preview 'sesh preview {}' \ -)\"" - -bind-key "N" display-popup -E "sesh ui" +bind -N "sesh selection" t run-shell "$HOME/.dotfiles/config/tmux/sesh-tmux.fish" +bind -N "last-session (via sesh) " L run-shell "sesh last" +bind -N "sesh ui" N display-popup -E "sesh ui" # ╭──────────────────────────────────────────────────────────╮ # │ Plugins │ diff --git a/docs/tmux-keybindings.md b/docs/tmux-keybindings.md index ca3a40c..d80ed66 100644 --- a/docs/tmux-keybindings.md +++ b/docs/tmux-keybindings.md @@ -33,8 +33,10 @@ Leader: `` ? List key bindings D Choose and detach a client from a list E Spread panes out evenly - L Switch to the last client + L last-session (via sesh) M Clear the marked pane + N sesh ui + T tms ] Paste the most recent paste buffer c Create a new window d Detach the current client @@ -46,7 +48,7 @@ Leader: `` o Select the next pane q Display pane numbers s Choose a session from a list - t tms + t sesh selection w Choose a window from a list x Kill the active pane z Zoom the active pane @@ -74,8 +76,6 @@ Leader: `` M-Left Resize the pane left by 5 M-Right Resize the pane right by 5 C-o Rotate through the panes - C-r tms refresh - C-s tms switch C-w tms windows C-z Suspend the current client C-Up Resize the pane up @@ -87,3 +87,4 @@ Leader: `` S-Left Move the visible part of the window left S-Right Move the visible part of the window right ``` +