diff options
| author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2026-02-21 15:06:46 +0100 |
|---|---|---|
| committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2026-02-21 15:06:46 +0100 |
| commit | 0529a8a19c332b30ae177bc75493bb16cf6be120 (patch) | |
| tree | 8dd423f7a622abdfe5ea0df1b4412db14451ae7b /.config/tmux/tmux.conf | |
| parent | f5c9813ba9098fe0d78aa660dbaf9741dad431ee (diff) | |
Add sesh
Diffstat (limited to '.config/tmux/tmux.conf')
| -rw-r--r-- | .config/tmux/tmux.conf | 124 |
1 files changed, 78 insertions, 46 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index e0d033e..3275731 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,87 +1,119 @@ -# Load tmux config -bind r source-file $HOME/.config/tmux/tmux.conf +# ─── Prefix ─────────────────────────────────────────────────────────────────── -# Bind prefix to C-a set-option -g prefix C-a unbind-key C-b bind-key C-a send-prefix +# ─── General ────────────────────────────────────────────────────────────────── + +set -g base-index 1 +set -g pane-base-index 1 +set -g renumber-windows on +set -g history-limit 50000 +set -g display-time 1500 +set -g status-interval 5 +set -g focus-events on +set -s escape-time 0 + +set-window-option -g aggressive-resize on +set-window-option -g mode-keys vi +set-window-option -g mouse off +set -g status-keys vi + +# ─── Terminal / Colors ──────────────────────────────────────────────────────── -# Allows vim to display colors correctly. set -g default-terminal "${TERM}" set -ga terminal-overrides ',*256col*:Tc' -set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' +set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # Undercurl -set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support -set -as terminal-overrides ',*:Setulc=\E[58::2::::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 +set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' +set -as terminal-overrides ',*:Setulc=\E[58::2::::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' + +# ─── Status Line ────────────────────────────────────────────────────────────── -# Status line set -g status on set -g status-position top -set -g focus-events on -set-option -sg status-interval 1 set-option -g status-style bg=#151515,fg=white set-option -g automatic-rename on -set-option -g renumber-windows on + set-option -g status-left "" -set -ga status-left '#[bg=#151515]#[fg=white] #{?window_zoomed_flag,, }' +set -ga status-left '#[bg=#151515]#[fg=white] #{?window_zoomed_flag,[Z], }' set-option -g status-right "" -set-option -g window-status-format " #[fg=#E1E1E1] #{window_index}#(echo ':')#{window_name}#{window_flag} " -set-option -g window-status-current-format " #[bold bg=#151515] > #{window_index}#(echo ':')#{window_name}#{window_flag} " -set -s escape-time 0 -set -g display-time 1500 -set -g status-interval 5 -set-window-option -g aggressive-resize on +set-option -g window-status-format " #[fg=#E1E1E1] #{window_index}:#{window_name}#{window_flags} " +set-option -g window-status-current-format " #[bold bg=#151515] > #{window_index}:#{window_name}#{window_flags} " -set -g status-keys vi -set -g history-limit 10000 +# ─── Reload Config ──────────────────────────────────────────────────────────── -set-window-option -g mode-keys vi -set-window-option -g mouse off +bind r source-file $HOME/.config/tmux/tmux.conf \; display "Config reloaded" + +# ─── Splits & Windows ───────────────────────────────────────────────────────── -# split panes -bind h split-window -h -bind v split-window -v +bind h split-window -h -c "#{pane_current_path}" +bind v split-window -v -c "#{pane_current_path}" unbind '"' unbind % -bind s list-sessions -bind-key N resize-pane -D 5 -bind-key E resize-pane -U 5 -bind-key I resize-pane -L 5 -bind-key M resize-pane -R 5 +bind c new-window -c "#{pane_current_path}" +bind s list-sessions -bind-key M-n resize-pane -D -bind-key M-e resize-pane -U -bind-key M-i resize-pane -L -bind-key M-m resize-pane -R +# ─── Pane Navigation (Colemak: m/n/e/i = left/down/up/right) ───────────────── -# Use Alt-vim keys without prefix key to switch panes bind -n M-m select-pane -L bind -n M-n select-pane -D bind -n M-e select-pane -U bind -n M-i select-pane -R +# ─── Pane Resize (prefix + capital, or Alt+Shift for single-step) ───────────── + +bind -r M resize-pane -L 5 +bind -r N resize-pane -D 5 +bind -r E resize-pane -U 5 +bind -r I resize-pane -R 5 + +bind -r M-m resize-pane -L +bind -r M-n resize-pane -D +bind -r M-e resize-pane -U +bind -r M-i resize-pane -R + +# ─── Copy Mode ──────────────────────────────────────────────────────────────── + bind Escape copy-mode bind p paste-buffer -bind -T copy-mode-vi v send -X begin-selection -bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i --clipboard" -bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i --clipboard" -bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -i --clipboard" -# 0 is too far from ` ;) -set -g base-index 1 +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi V send -X select-line +bind -T copy-mode-vi C-v send -X rectangle-toggle +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i --clipboard" +bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -i --clipboard" +bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel -i --clipboard" -# No delay for escape key press -set -sg escape-time 0 +# ─── Floating Terminal ──────────────────────────────────────────────────────── -# Fire up a floating terminal bind-key -n -N 'Toggle popup window' M-g if-shell -F '#{==:#{session_name},popup}' { detach-client } { display-popup -d "#{pane_current_path}" \ - -xC -yC -w 80% -h 75% \ - -E 'tmux attach-session -t popup || tmux new-session -s popup' + -xC -yC -w 80% -h 75% \ + -E 'tmux attach-session -t popup || tmux new-session -s popup' } + +# ─── Sesh ───────────────────────────────────────────────────────────────────── + +set -g detach-on-destroy off +bind -N "last-session (via sesh)" L run-shell "sesh last" + +bind-key T run-shell "sesh connect \"$( + 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 kill ^f find' \ + --bind 'tab:down,btab:up' \ + --bind 'ctrl-a:change-prompt(\uf0e7 )+reload(sesh list --icons)' \ + --bind 'ctrl-t:change-prompt(\uf2d2 )+reload(sesh list -t --icons)' \ + --bind 'ctrl-x:change-prompt(\uf013 )+reload(sesh list -z --icons)' \ + --bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(\uf1f8 )+reload(sesh list --icons)' \ + --bind 'ctrl-f:change-prompt(\uf002 )+reload(fd -H -d 2 -t d . ~)' \ + --preview 'sesh preview {}' \ + --preview-window 'right:55%' +)\"" |