-
Notifications
You must be signed in to change notification settings - Fork 7
/
tmux.conf
214 lines (166 loc) · 7.41 KB
/
tmux.conf
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# Tmux config file
conf_dir="$HOME/.config/tmux"
# set-option, -g for global, -a to append to existing option.
# Enable mouse selection and option toggling.
set-window-option -g mouse on
# Enable vi for copy-mode.
set-window-option -g mode-keys vi
set-window-option -g xterm-keys on
# Set clipboard using OSC 52 ANSI escapes
set-window-option -g set-clipboard on
# Increase history because memory is cheap.
set-option -g history-limit 100000
# How long to display messages for in milliseconds.
set-option -g display-time 1500
# Address vim mode switching delay (http://superuser.com/a/252717/65504)
set-option -s escape-time 0
# Focus events enabled for terminals that support them.
set-option -g focus-events on
# Use C-t as the prefix because it's less useful than C-b.
unbind C-b
set-option -g prefix C-t
# Start windows numbering at 1.
set-option -g base-index 0
# Start pane numbering at 1.
set-window-option -g pane-base-index 0
# Re-number windows when a window is closed.
set-option -g renumber-windows on
# Update status line every 5 seconds (default 15).
set-option -g status-interval 5
# Enable 24 bit color.
set-option -g default-terminal "xterm-24bit"
# Enable 24 bit color support.
# https://github.com/syl20bnr/spacemacs/wiki/Terminal
set-option -g -a terminal-overrides ',xterm-24bit:Tc'
set-option -g default-shell /bin/zsh
set-option -g default-command "${SHELL}"
bind-key R run-shell ' \
tmux source-file ~/.tmux.conf > /dev/null; \
tmux display-message "Reloaded .tmux.conf."'
bind-key -T root C-y run-shell "tmux-smart-paste"
# Copy / Paste
bind-key C-t copy-mode
# Send the normal Tmux prefix. Useful for passing commands to nested Tmux.
bind-key C-b send-keys C-b
# `send-keys -X` sends a command into copy mode.
bind-key -T copy-mode-vi 'C-g' send-keys -X cancel
bind-key P paste-buffer
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'C-v' send-keys -X rectangle-toggle
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "clipboard-copy"
bind-key -T copy-mode-vi 'C-y' send-keys -X copy-selection
bind-key -T copy-mode-vi 'p' send-keys -X paste-buffer
bind-key -T copy-mode-vi 'H' send-keys -X start-of-line
bind-key -T copy-mode-vi 'L' send-keys -X end-of-line
bind-key -T copy-mode-vi 'J' send-keys -X -N 5 cursor-down
bind-key -T copy-mode-vi 'K' send-keys -X -N 5 cursor-up
bind-key -T copy-mode-vi 'C-j' send-keys -X page-down
bind-key -T copy-mode-vi 'C-k' send-keys -X page-up
bind-key -T copy-mode-vi 'Y' send-keys -X copy-end-of-line
bind-key -T copy-mode-vi 'C-r' send-keys -X search-backward-incremental
bind-key -T copy-mode-vi 'C-s' send-keys -X search-forward-incremental
bind-key -T copy-mode-vi 'c' send-keys -X copy-pipe-and-cancel "tmux-copy-with-osc-52" \; display-message "Copied to clipboard."
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "clipboard-copy" \; display-message "Copied to clipboard."
bind-key + delete-buffer
set-hook -g pane-focus-in 'run-shell tmux-on-pane-focus-in'
# new-session -d -n ranger -s dev ranger
# new-window -d
# Window and pane management
# Special tokens for windows
# Token Meaning
# {start} ^ The lowest-numbered window
# {end} $ The highest-numbered window
# {last} ! The last (previously current) window
# {next} + The next window by number
# {previous} - The previous window by number
# Select windows.
bind-key -T root -r C-M-l next-window
bind-key -T root -r C-M-h previous-window
# Kill the current window.
bind-key x kill-window
bind-key c new-window -c "#{pane_current_path}"
bind-key / split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
# Special tokens for panes
# {last} ! The last (previously active) pane
# {next} + The next pane by number
# {previous} - The previous pane by number
# {top} The top pane
# {bottom} The bottom pane
# {left} The leftmost pane
# {right} The rightmost pane
# {top-left} The top-left pane
# {top-right} The top-right pane
# {bottom-left} The bottom-left pane
# {bottom-right} The bottom-right pane
# {up-of} The pane above the active pane
# {down-of} The pane below the active pane
# {left-of} The pane to the left of the active pane
# {right-of} The pane to the right of the active pane
# Select panes with vi movement commands.
bind-key -T root -r M-h select-pane -L
bind-key -T root -r M-j select-pane -D
bind-key -T root -r M-k select-pane -U
bind-key -T root -r M-l select-pane -R
# Move panes around within a window and follow the moving pane.
bind-key -T root -r M-H swap-pane -t {left-of} \; select-pane -t {left-of}
bind-key -T root -r M-J swap-pane -t {down-of} \; select-pane -t {down-of}
bind-key -T root -r M-K swap-pane -t {up-of} \; select-pane -t {up-of}
bind-key -T root -r M-L swap-pane -t {right-of} \; select-pane -t {right-of}
# Move current pane into a new window in the specified direction.
bind-key -T root M-Left break-pane \; select-window -t {last}
bind-key -T root M-Right break-pane \; select-window -t {last} \; \
move-window -r -t {last}
# Pull one pane from the specified direction into current window. Reverses the
# command above.
bind-key -T root M-S-Left join-pane -s :{previous}
bind-key -T root M-S-Right join-pane -s :{next}
# Pull a pane into current window as a new pane.
bind-key @ command-prompt -p "create pane from:" "join-pane -s ':%%'"
# Small pane resizes.
bind-key -T root C-Left resize-pane -L 2
bind-key -T root C-Down resize-pane -D 2
bind-key -T root C-Up resize-pane -U 2
bind-key -T root C-Right resize-pane -R 2
# Large pane resizes.
bind-key -T root C-S-Up resize-pane -U 8
bind-key -T root C-S-Down resize-pane -D 8
bind-key -T root C-S-Left resize-pane -L 8
bind-key -T root C-S-Right resize-pane -R 8
# Kill panes with a dedicated key.
bind-key -T root -r C-M-k kill-pane
# Layouts
bind-key -T root M-Up next-layout
bind-key -T root M-Down previous-layout
# FZF commands
bind-key -T prefix F run-shell "zsh -c \
'iosource-list-file-paths-from-tmux-pane #{pane_id} \
| fzf-tmux -- --reverse --multi \
| join-input-by-space'"
# Status bar
set-option -g status-left-length 32
set-option -g status-right-length 150
set-option -g status-left '#[fg=white][#S] '
set-option -g window-status-format " #I:#W "
set-window-option -g window-status-current-format "#[bg=#00533A] #I:#W#{?window_zoomed_flag, (zoom),} "
set-option -g status-right ''
# Colors
set-option -g status-fg white
set-option -g status-bg '#18191b'
set-option -g window-status-style bold
# Use default background so it doesn't get overridden to black
# set-option -g window-style 'bg=#00171d'
# set-option -g window-active-style 'bg=colour0'
set-option -g pane-border-style fg=colour245
set-option -g pane-active-border-style fg=blue
set-option -g message-style fg=yellow,bg='#18191b'
set-option -g @prefix_highlight_show_copy_mode 'on'
# List of plugins
set-option -g @plugin 'tmux-plugins/tpm'
set-option -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set-option -g @plugin 'tmux-plugins/tmux-open'
set-option -g @prefix_highlight_bg 'blue'
set-option -g @prefix_highlight_show_copy_mode 'on'
set-option -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'