-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
204 lines (148 loc) · 5.44 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
### Global options
# Change the prefix (leader) key
set-option -g prefix c-a
# Key repress timeout
set-option -g repeat-time 3000
# History limit
set-option -g history-limit 10000
# support 256 colors
set-option -g default-terminal "screen-256color"
# needed for italics fix - but breaks alternate screen which
# alternate-screen doesn't seem to fix
# set-option -g default-terminal "tmux-256color"
# fix italics
# set -as terminal-overrides ',xterm*:sitm=\E[3m'
# set-option -g alternate-screen on
# turn on utf8
# set-window-option -g utf8 on
# start windows from index 1
set-option -g base-index 1
# start panes from index 1
set-window-option -g pane-base-index 1
# no delay between command sequences
set-option -sg escape-time 0
# current window only as small as smallest client watching it
set-window-option -g aggressive-resize on
set-option -g wrap-search off
set -g focus-events on
### Key mappings
# reload config
bind-key R source-file ~/.tmux.conf \; \
display-message "Tmux config reloaded"
# send prefix to nested apps
bind-key c-a send-prefix
# kill whole session
bind-key q confirm kill-session
# cycle through predefined layouts
bind-key -r L next-layout
# Don't accidentaly kill session when trying to kill pane
unbind-key q
# toggle status line
bind-key S set-option status
# kill and respawn pane
bind-key X respawn-pane -k
### Windows
# toggle last window like screen
bind-key Space last-window
# flip through windows
bind-key -r n next
bind-key -r p prev
# duplicate input into all panes of current window toggle
# bind-key -r TODO set-window-option synchronize-panes
# See xpanes to easily synchronize panes.
# additional way to select the first 10 windows
bind-key -n F1 select-window -t :1
bind-key -n F2 select-window -t :2
bind-key -n F3 select-window -t :3
bind-key -n F4 select-window -t :4
bind-key -n F5 select-window -t :5
bind-key -n F6 select-window -t :6
bind-key -n F7 select-window -t :7
bind-key -n F8 select-window -t :8
bind-key -n F9 select-window -t :9
bind-key -n F10 select-window -t :10
bind-key 0 select-window -t :10
### Panes
# resize pane
bind-key -r + resize-pane -U 1
bind-key -r - resize-pane -D 1
bind-key -r < resize-pane -L 1
bind-key -r > resize-pane -R 1
# "refresh" pane
bind-key -r P resize-pane -U 1 \; resize-pane -D 1
# flip through panes
bind-key -r \; select-pane -t :.+
bind-key -r , select-pane -t :.-
# fallback pane navigation if vim is not responding
bind-key -r l select-pane -R
bind-key -r h select-pane -L
bind-key -r k select-pane -U
bind-key -r j select-pane -D
# split a pane
bind-key C-v split-window -v
bind-key C-h split-window -h
bind-key r resize-pane -x 82
# move pane into own window
bind-key J break-pane -d
# move pane to current window
bind-key j choose-window 'join-pane -vs %%'
### Vim integration
# NOTE: current tmux pane id in environment: $TMUX_PANE
# NOTE: get several tmux infos: tmux display -p '#{pane_width}'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
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 -n 'C-\' if-shell "$is_vim" "send-keys 'C-\\'" "select-pane -l"
# Restore Clear Screen (C-l)
bind-key C-l send-keys 'C-l'
### Copy-mode
# use vim motion keys while in copy mode
set-option -g status-keys vi
set-window-option -g mode-keys vi
set-window-option -g xterm-keys on
# List copy-mode keymaps:
# tmux list-keys ; tmux list-keys -t copy-mode-vi
bind-key c-b copy-mode \; send-keys c-b c-f
# bind-key -T copy-mode-vi y send -X copy-pipe "xclip -i >/dev/null"
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -i -selection clip-board >/dev/null"
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
unbind-key -T copy-mode-vi Enter
### Status line
# To see configuration changes of the status line
# all tmux instances have to be restarted
set-window-option -g monitor-activity on
set-option -g visual-activity off
# set-option -g visual-content off
set-option -g visual-bell off
set-option -g bell-action none
# left length - default is 10
set-option -g status-left-length 80
set-option -g status-left " #H "
## colors
set-option -g status-style 'bg=colour249,fg=colour240'
# set-option -g status-attr dim
# active window title colors
set-window-option -g window-status-style bg=colour249,fg=colour238
set-option -g window-status-current-style 'bg=#E2E3E5'
# TODO: find nicer style; fix vim leave activity
set-option -g window-status-activity-style ''
# set-option -g window-status-activity-style 'bg=#CCE5FF'
# set-option -g window-status-bell-style 'bg=#CCE5FF'
# Highlight active window background
# set -g window-style 'bg=colour231'
# set -g window-active-style 'bg=colour231'
set -g pane-border-style 'fg=colour245,bg=colour245'
set -g pane-active-border-style 'fg=colour245,bg=colour245'
# window title status format
set-option -g window-status-format "#I"
set-option -g window-status-current-format "#I"
set-option -g window-status-separator " "
set-option -g status-right "KW%V | %a | %F | %R "
# command/message line colors
set-option -g message-style 'bg=colour249,fg=black'