summaryrefslogtreecommitdiff
path: root/.config/tmux/tmux.conf
blob: 04618aafe92cd2a89b8e15945e01cfe298c3f47f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# ─── Prefix ───────────────────────────────────────────────────────────────────

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 ────────────────────────────────────────────────────────

set -g default-terminal "${TERM}"
set -ga terminal-overrides ',*256col*:Tc'
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'

# Undercurl
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 ──────────────────────────────────────────────────────────────

set -g status on
set -g status-position top
set-option -g status-style bg=#151515,fg=white
set-option -g automatic-rename on

set-option -g status-left ""
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}:#{window_name}#{window_flags} "
set-option -g window-status-current-format " #[bold bg=#151515] > #{window_index}:#{window_name}#{window_flags} "

# ─── Reload Config ────────────────────────────────────────────────────────────

bind r source-file $HOME/.config/tmux/tmux.conf \; display "Config reloaded"

# ─── Splits & Windows ─────────────────────────────────────────────────────────

bind h split-window -h -c "#{pane_current_path}"
bind v split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %

bind c new-window -c "#{pane_current_path}"
bind s list-sessions

# ─── Pane Navigation (Colemak: m/n/e/i = left/down/up/right) ─────────────────

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 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"

# ─── Floating Terminal ────────────────────────────────────────────────────────

bind-key -n -N 'Toggle popup window' M-g if-shell -F '#{m:popup-*,#{session_name}}' {
    detach-client
} {
    display-popup -d "#{pane_current_path}" \
    -xC -yC -w 80% -h 75% \
    -E "~/.config/tmux/popup.sh"
}

# ─── 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 | grep -v '^popup-' | 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%'
)\""