-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.tmux.conf
More file actions
141 lines (99 loc) · 4.18 KB
/
Copy path.tmux.conf
File metadata and controls
141 lines (99 loc) · 4.18 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
set -g default-terminal "tmux-256color"
# RGB color + undercurl
set -ga terminal-features ",*:usstyle"
set -gs terminal-overrides ",*:RGB"
# Kitty support
set-option -as terminal-overrides ',xterm-kitty:blink=\E[5m'
set-option -as terminal-features ',xterm-kitty:RGB:extkeys:hyperlinks:clipboard'
# Pi agent support
set -g extended-keys always
set -g extended-keys-format csi-u
# Clipboard
set -g set-clipboard on
# Allow passthrough for modern terminal features
set -gq allow-passthrough on
# Focus events for editors/agents
set-option -g focus-events on
# Timing
set -sg escape-time 1
set -g display-time 1500
set -g display-panes-time 2000
# General
# Prefix: Ctrl-s
unbind C-b
set -g prefix C-s
bind C-s send-prefix
# Reload config
bind-key r source-file ~/.tmux.conf \; display-message "Reloaded!"
# Session / worktree-agent switcher (sx — Go TUI, replaces session-switcher.sh)
# enter: switch | ctrl-x: kill | ctrl-n: new session | ctrl-w: worktree
bind-key s run-shell '$HOME/go/bin/sx'
# Input
set -g mouse on
setw -g mode-keys vi
# Scrollback
set -g history-limit 100000
# Windows and panes start from 1
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
# ─────────────────────────────────────────────────────────────────────
# Status bar — Gruvbox (auto-detects system light/dark mode)
# ─────────────────────────────────────────────────────────────────────
set -g status on
set -g status-position top
set -g status-justify left
set -g status-interval 5
set -g status-left-length 60
set -g status-right-length 150
set -g window-status-separator " "
# Apply the theme matching the current system color-scheme
run-shell ~/.config/tmux/apply-system-theme.sh
# Manual toggle fallback (prefix + T) — mostly for debugging
bind-key T run-shell ~/.config/tmux/toggle-theme.sh
# Activity
set -g visual-activity off
# Key Bindings — Panes / Windows
# Split panes using | and -
unbind '"'
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Close pane without confirmation
bind-key x kill-pane
# New window in current path
bind-key c new-window -c "#{pane_current_path}"
# Window navigation
bind-key -n C-S-Left previous-window
bind-key -n C-S-Right next-window
# Key Bindings — Vim / Neovim-aware Navigation
%hidden VIM_PATTERN='(\S+\/)?g?\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?$'
%hidden IS_VIM="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +${VIM_PATTERN}'"
bind-key -n C-h if-shell "$IS_VIM" 'send-keys C-h' 'select-pane -L'
bind-key -n C-j if-shell "$IS_VIM" 'send-keys C-j' 'select-pane -D'
bind-key -n C-k if-shell "$IS_VIM" 'send-keys C-k' 'select-pane -U'
bind-key -n C-l if-shell "$IS_VIM" 'send-keys C-l' 'select-pane -R'
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -n M-h if-shell "$IS_VIM" 'send-keys M-h' 'resize-pane -L 1'
bind-key -n M-j if-shell "$IS_VIM" 'send-keys M-j' 'resize-pane -D 1'
bind-key -n M-k if-shell "$IS_VIM" 'send-keys M-k' 'resize-pane -U 1'
bind-key -n M-l if-shell "$IS_VIM" 'send-keys M-l' 'resize-pane -R 1'
# Key Bindings — Copy Mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind-key -T copy-mode-vi Escape send-keys -X cancel
# Copy using tmux clipboard / OSC 52
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Extra Wayland fallback: Prefix + Y copies current tmux buffer to wl-copy
bind-key Y run-shell 'tmux save-buffer - | wl-copy'
# TPM Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'