-
Notifications
You must be signed in to change notification settings - Fork 3
/
tmux.conf
184 lines (147 loc) · 5.49 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
# Don't lose ENV
# Remove SSH_AUTH_SOCK to disable tmux automatically resetting the variable
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# fix ssh agent when tmux is detached
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh-agent.socket
# terminal override for 24-bit color
set-option -ga terminal-overrides ",*256col*:Tc"
set-option -g default-terminal "tmux-256color"
## keybindings
unbind C-b
unbind C-a
unbind ,
unbind .
unbind n
unbind p
unbind [
unbind '"'
unbind l
unbind &
unbind "'"
set-option -g prefix C-a # C-a for prefix just like screen
bind-key C-a last-window
bind-key + resize-pane -Z
bind-key = resize-pane -Z
bind-key | split-window -h
bind-key \ split-window -h
bind-key - split-window -v
# windows and panes
bind-key S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
bind-key u select-window -t :1
bind-key W split-window -c '#{pane_current_path}' -h \; choose-window 'kill-pane ; join-pane -hs %%'
bind-key x kill-pane
bind-key X kill-window
bind-key q confirm-before kill-session
bind-key Q confirm-before kill-server
bind-key , previous-window # <
bind-key . next-window # >
bind-key < swap-window -t :-
bind-key > swap-window -t :+
bind-key BSpace switch-client -l
bind-key c new-window -c '#{pane_current_path}'
bind-key % split-window -c '#{pane_current_path}' -h
# vi mode
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# Smart pane switching with awareness of vim splits
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Bring back clear screen under tmux prefix
bind C-l send-keys 'C-l'
# Bring back kill line under tmux prefix
bind C-k send-keys 'C-k'
bind-key n command-prompt 'rename-window "%%"'
bind-key N command-prompt 'rename-session "%%"'
bind-key Escape copy-mode -u
bind-key Up copy-mode -u
bind-key r source-file $HOME/.tmux.conf\; display "~/.tmux.conf reloaded"
bind-key R refresh-client
bind-key a send-key C-a
# -r: can be repeated without pressing prefix# again (501ms after last '-r' action or prefix)
bind-key -r h select-pane -t :.-
bind-key -r l select-pane -t :.+
bind -n End send-key C-e
bind -n Home send-key C-a
## messages
set-option -g quiet
set-option -g message-fg colour0
set-option -g message-bg colour4
set-option -g display-time 2000
## set status bar
# set-option -g status-utf8 on
set-option -g status-interval 2
set-option -g status-fg default
set-option -g status-bg default
# set-option -g status-style 'fg=green'
# set-option -g status-left-fg default
# set-option -g status-left-bg default
# set-option -g status-right-bg default
bind-key / set-option status
# "I' == current window index
# 'H' == Hostname
# 'F' == current window flag
# 'P' == current pane index
# 'S' == Session name
# 'T' == current window title
# 'W' == current window name
# '#' == a literal "#"
# Where appropriate, special character sequences may be prefixed with a
# number to specify the maximum length, in this line "#10W'.
set -g status-left ""
set-option -g status-right '#{prefix_highlight} #[fg=yellow]#S#[fg=default] [#I:#P] #(date -u +%%H:%%M) UTC | #[fg=default]%a %d %b %H:%M'
set-option -g status-right-length 100
# set-option -g status-left-length 120
set-window-option -g window-status-format ' #[fg=white]#I #[dim]#W#[none] '
## highlight active window
# set-window-option -g window-status-current-attr bright
set-window-option -g window-status-current-bg blue
set-window-option -g window-status-current-format '#[fg=colour15] #I #[fg=colour00]#W '
set-window-option -g window-status-bell-fg colour01
# set-window-option -g window-status-bell-bg colour23
# renumber windows
set-option -g renumber-windows on
# starts windows at 1 not 0
set-option -g base-index 1
set-option -g visual-activity off
set-option -g set-titles on
set-option -gw automatic-rename on
set-option -gw monitor-activity off
set -g mouse on
# Toggle mouse on
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
## pane border and colors
set-option -g pane-active-border-fg colour4
set-option -g pane-active-border-bg default
## chooser colors
set-window-option -g mode-bg colour4 # selector background
set-window-option -g mode-fg black # selector foreground
### Copy/paste
#unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe 'reattach-to-user-namespace pbcopy'
#set-option -g default-command "reattach-to-user-namespace -l zsh; tmux rename-window zsh"
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Automatic TPM installation
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"
# Install plugins with prefix+I
run '~/.tmux/plugins/tpm/tpm'
# Local config
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
# vim: set ft=tmux: