/
.tmux.conf
176 lines (135 loc) · 4.73 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
# Use a modern terminal
set -g default-terminal xterm-256color
# Remap tmux command prefix from Ctrl + B to Ctrl + Z
set -g prefix C-z
bind-key C-z send-prefix
unbind C-z
# Reload tmux config with Prefix + R
bind r source-file ~/.tmux.conf
# Start window and pane numbering at 1
set -g base-index 1
set -g pane-base-index 1
# Refresh window numbers when a window is closed
set -g renumber-windows on
# Enable mouse support
set -g mouse on
# Use vim style key bindings
set -g mode-keys vi
set -g status-keys vi
# Exclude small clients viewing in background mode from limiting larger clients maximum size
setw -g aggressive-resize on
# Use F2 to rename the current window
bind -n F2 command-prompt "rename-window '%%'"
# Use Ctrl + Alt + Arrow keys to switch windows
bind -n M-C-Right next-window
bind -n M-C-Left previous-window
# Use Ctrl + Alt + Vim keys to switch windows
bind -n M-C-l next-window
bind -n M-C-h previous-window
# Use Ctrl + N to create a new window
bind -n C-n new-window -c "#{pane_current_path}"
# Use Ctrl + Arrow keys to create a new pane in the given direction
bind -n C-Left split-window -hb -c '#{pane_current_path}'
bind -n C-Up split-window -vb -c '#{pane_current_path}'
bind -n C-Right split-window -h -c '#{pane_current_path}'
bind -n C-Down split-window -v -c '#{pane_current_path}'
# Use Alt + Arrow keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Use Alt + Vim keys to switch panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# Use Alt + Shift + Arrow keys to resize panes
bind -n M-S-Up resize-pane -U 5
bind -n M-S-Down resize-pane -D 5
bind -n M-S-Left resize-pane -L 5
bind -n M-S-Right resize-pane -R 5
# Use Alt + Shift + Vim keys to resize panes
bind -n M-S-H resize-pane -U 5
bind -n M-S-J resize-pane -D 5
bind -n M-S-K resize-pane -L 5
bind -n M-S-L resize-pane -R 5
# Use Ctrl + Alt + E to cycle layout
bind -n C-M-e next-layout
# Use Ctrl + Shift + E reverse rotate panes
bind -n C-S-e rotate-window -D
# Use Alt + Enter to zoom current pane
bind -n M-enter resize-pane -Z
# Use Ctrl + Q to close current pane
bind -n C-q kill-pane
# Use Ctrl + Shift + Q to close current window
bind -n C-S-q kill-window
# Kill session with Ctrl + D
bind -n C-d kill-session
# Send Ctrl + D with Prefix + D to avoid killing session
bind d send-keys C-d
# Bind home and end keys manually
bind -n Home send-key C-a
bind -n End send-key C-e
# Active pane colours
set -g window-active-style fg=colour255
set -g pane-active-border-bg colour16
set -g pane-active-border-fg colour236
# Inactive pane colours
set -g window-style fg=colour250
set -g pane-border-bg colour16
set -g pane-border-fg colour234
# Background status bar colours
set -g status-bg colour234
set -g status-attr default
# Left status bar colours
set -g status-left-fg colour240
set -g status-left-bg colour234
set -g status-left-attr default
# Right status bar colours
set -g status-right-fg colour240
set -g status-right-bg default
set -g status-right-attr default
# Tab colours
setw -g window-status-fg colour240
setw -g window-status-bg default
# Active tab colours
setw -g window-status-current-fg colour16
setw -g window-status-current-bg colour46
setw -g window-status-current-attr default
# Tmux command input box colours
set -g message-fg colour16
set -g message-bg colour62
# Tab title format
setw -g window-status-current-format '#{?window_zoomed_flag,#[bg=magenta],} #I: #W '
set -g window-status-format '#I: #W '
# Left status bar text
set -g status-left ' '
# Right status bar length
set -g status-right-length 80
# Status bar widgets
CLOCK='#[fg=colour2]#(date +%I)#[fg=colour240]:#[fg=colour2]#(date +%M) #(if [ `date +%p` = "AM" ]; then echo \#[fg=colour3]; else echo \#[fg=colour67]; fi)#(date +%p)'
UPTIME='up #(uptime -p | cut -d " " -f2- | tr -d , | sed -E "s;([0-9]+);#[fg=colour2]\1#[fg=colour240];g")'
# Set status bar widgets based on local or remote session
set -g status-right "#{sysstat_cpu} | #{sysstat_mem} | $UPTIME | $CLOCK "
# Use Ctrl + ` to toggle remote tmux session focus on
bind -n ^@ \
set key-table off \;\
set prefix None \;\
set status off \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S
# Use Ctrl + ` to toggle remote tmux session focus off
bind -T off ^@ \
set -u key-table \;\
set -u prefix \;\
set -u window-status-current-style \;\
set status on \;\
refresh-client -S
# Enable tmux plugins
set -g @plugin nhdaly/tmux-better-mouse-mode
set -g @plugin sabrehagen/tmux-plugin-sysstat
set -g @plugin tmux-plugins/tmux-copycat
set -g @plugin tmux-plugins/tmux-sensible
set -g @plugin tmux-plugins/tmux-yank
# Initialize tmux plugin manager
run -b ~/.tmux/plugins/tpm/tpm