Skip to content

Commit 7ca78df

Browse files
authored
Merge pull request #2 from hallazzang/2.9
update for tmux 2.9
2 parents 37180d1 + 9df2bf0 commit 7ca78df

File tree

3 files changed

+355
-148
lines changed

3 files changed

+355
-148
lines changed

build.py

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@
77

88
# Extracted from http://man7.org/linux/man-pages/man1/tmux.1.html#OPTIONS
99
# Some options are ignored(see commented items)
10-
session_options = (
10+
server_options = (
1111
'buffer-limit',
1212
# 'command-alias', # Ignored: is array
1313
'default-terminal',
1414
'escape-time',
15+
'exit-empty',
1516
'exit-unattached',
1617
'focus-events',
1718
'history-file',
1819
'message-limit',
1920
'set-clipboard',
2021
# 'terminal-overrides', # Ignored: is array
22+
# 'user-keys', # Ignored: is array
23+
)
24+
25+
session_options = (
2126
'activity-action',
2227
'assume-paste-time',
2328
'base-index',
2429
'bell-action',
2530
'default-command',
2631
# 'default-shell', # Ignored: to set $SHELL correctly
32+
'default-size',
2733
'destroy-unattached',
2834
'detach-on-destroy',
2935
'display-panes-active-colour',
@@ -45,6 +51,7 @@
4551
'set-titles-string',
4652
'silence-action',
4753
'status',
54+
# 'status-format' # Ignored: is array
4855
'status-interval',
4956
'status-justify',
5057
'status-keys',
@@ -55,8 +62,8 @@
5562
'status-right',
5663
'status-right-length',
5764
'status-right-style',
65+
'status-style',
5866
# 'update-environment', # Ignored: is array
59-
# 'user-keys', # Ignored: is array
6067
'visual-activity',
6168
'visual-bell',
6269
'visual-silence',
@@ -65,16 +72,13 @@
6572

6673
window_options = (
6774
'aggressive-resize',
68-
'allow-rename',
69-
'alternate-screen',
7075
'automatic-rename',
7176
'automatic-rename-format',
7277
'clock-mode-colour',
7378
'clock-mode-style',
74-
'force-height',
75-
'force-width',
7679
'main-pane-height',
7780
'main-pane-width',
81+
'mode-keys',
7882
'mode-style',
7983
'monitor-activity',
8084
'monitor-bell',
@@ -86,9 +90,7 @@
8690
'pane-border-format',
8791
'pane-border-status',
8892
'pane-border-style',
89-
'remain-on-exit',
9093
'synchronize-panes',
91-
'window-active-style',
9294
'window-status-activity-style',
9395
'window-status-bell-style',
9496
'window-status-current-format',
@@ -97,12 +99,20 @@
9799
'window-status-last-style',
98100
'window-status-separator',
99101
'window-status-style',
100-
'window-style',
102+
'window-size',
101103
'wrap-search',
102104
'xterm-keys',
103105
)
104106

105-
# Copied from https://github.com/tmux/tmux/blob/2.6/key-bindings.c
107+
pane_options = (
108+
'allow-rename',
109+
'alternate-screen',
110+
'remain-on-exit',
111+
'window-active-style',
112+
'window-style',
113+
)
114+
115+
# Copied from https://github.com/tmux/tmux/blob/2.9/key-bindings.c
106116
initial_key_bindings = (
107117
"bind C-b send-prefix",
108118
"bind C-o rotate-window",
@@ -111,13 +121,13 @@
111121
"bind ! break-pane",
112122
"bind '\"' split-window",
113123
"bind '#' list-buffers",
114-
"bind '$' command-prompt -I'#S' \"rename-session '%%'\"",
115-
"bind \"%\" split-window -h",
116-
"bind \"&\" confirm-before -p\"kill-window #W? (y/n)\" kill-window",
124+
"bind '$' command-prompt -I'#S' \"rename-session -- '%%'\"",
125+
"bind % split-window -h",
126+
"bind & confirm-before -p\"kill-window #W? (y/n)\" kill-window",
117127
"bind \"'\" command-prompt -pindex \"select-window -t ':%%'\"",
118-
"bind \"(\" switch-client -p",
119-
"bind \")\" switch-client -n",
120-
"bind , command-prompt -I'#W' \"rename-window '%%'\"",
128+
"bind ( switch-client -p",
129+
"bind ) switch-client -n",
130+
"bind , command-prompt -I'#W' \"rename-window -- '%%'\"",
121131
"bind - delete-buffer",
122132
"bind . command-prompt \"move-window -t '%%'\"",
123133
"bind 0 select-window -t:=0",
@@ -132,16 +142,17 @@
132142
"bind 9 select-window -t:=9",
133143
"bind : command-prompt",
134144
"bind \\; last-pane",
135-
"bind = choose-buffer",
145+
"bind = choose-buffer -Z",
136146
"bind ? list-keys",
137-
"bind D choose-client",
147+
"bind D choose-client -Z",
148+
"bind E select-layout -E",
138149
"bind L switch-client -l",
139150
"bind M select-pane -M",
140151
"bind [ copy-mode",
141152
"bind ] paste-buffer",
142153
"bind c new-window",
143154
"bind d detach-client",
144-
"bind f command-prompt \"find-window '%%'\"",
155+
"bind f command-prompt \"find-window -Z -- '%%'\"",
145156
"bind i display-message",
146157
"bind l last-window",
147158
"bind m select-pane -m",
@@ -150,13 +161,13 @@
150161
"bind p previous-window",
151162
"bind q display-panes",
152163
"bind r refresh-client",
153-
"bind s choose-tree -s",
164+
"bind s choose-tree -Zs",
154165
"bind t clock-mode",
155-
"bind w choose-tree -w",
166+
"bind w choose-tree -Zw",
156167
"bind x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane",
157168
"bind z resize-pane -Z",
158-
"bind \"{\" swap-pane -U",
159-
"bind \"}\" swap-pane -D",
169+
"bind { swap-pane -U",
170+
"bind } swap-pane -D",
160171
"bind '~' show-messages",
161172
"bind PPage copy-mode -u",
162173
"bind -r Up select-pane -U",
@@ -171,6 +182,11 @@
171182
"bind M-n next-window -a",
172183
"bind M-o rotate-window -D",
173184
"bind M-p previous-window -a",
185+
"bind -r S-Up refresh-client -U 10",
186+
"bind -r S-Down refresh-client -D 10",
187+
"bind -r S-Left refresh-client -L 10",
188+
"bind -r S-Right refresh-client -R 10",
189+
"bind -r DC refresh-client -c",
174190
"bind -r M-Up resize-pane -U 5",
175191
"bind -r M-Down resize-pane -D 5",
176192
"bind -r M-Left resize-pane -L 5",
@@ -238,17 +254,17 @@
238254
"bind -Tcopy-mode M-7 command-prompt -Np'(repeat)' -I7 'send -N \"%%%\"'",
239255
"bind -Tcopy-mode M-8 command-prompt -Np'(repeat)' -I8 'send -N \"%%%\"'",
240256
"bind -Tcopy-mode M-9 command-prompt -Np'(repeat)' -I9 'send -N \"%%%\"'",
241-
"bind -Tcopy-mode \"M-<\" send -X history-top",
242-
"bind -Tcopy-mode \"M->\" send -X history-bottom",
257+
"bind -Tcopy-mode M-< send -X history-top",
258+
"bind -Tcopy-mode M-> send -X history-bottom",
243259
"bind -Tcopy-mode M-R send -X top-line",
244260
"bind -Tcopy-mode M-b send -X previous-word",
245261
"bind -Tcopy-mode M-f send -X next-word-end",
246262
"bind -Tcopy-mode M-m send -X back-to-indentation",
247263
"bind -Tcopy-mode M-r send -X middle-line",
248264
"bind -Tcopy-mode M-v send -X page-up",
249265
"bind -Tcopy-mode M-w send -X copy-selection-and-cancel",
250-
"bind -Tcopy-mode \"M-{\" send -X previous-paragraph",
251-
"bind -Tcopy-mode \"M-}\" send -X next-paragraph",
266+
"bind -Tcopy-mode M-{ send -X previous-paragraph",
267+
"bind -Tcopy-mode M-} send -X next-paragraph",
252268
"bind -Tcopy-mode M-Up send -X halfpage-up",
253269
"bind -Tcopy-mode M-Down send -X halfpage-down",
254270
"bind -Tcopy-mode C-Up send -X scroll-up",
@@ -297,7 +313,7 @@
297313
"bind -Tcopy-mode-vi T command-prompt -1p'(jump to backward)' 'send -X jump-to-backward \"%%%\"'",
298314
"bind -Tcopy-mode-vi V send -X select-line",
299315
"bind -Tcopy-mode-vi W send -X next-space",
300-
"bind -Tcopy-mode-vi \"^\" send -X back-to-indentation",
316+
"bind -Tcopy-mode-vi ^ send -X back-to-indentation",
301317
"bind -Tcopy-mode-vi b send -X previous-word",
302318
"bind -Tcopy-mode-vi e send -X next-word-end",
303319
"bind -Tcopy-mode-vi f command-prompt -1p'(jump forward)' 'send -X jump-forward \"%%%\"'",
@@ -312,8 +328,8 @@
312328
"bind -Tcopy-mode-vi t command-prompt -1p'(jump to forward)' 'send -X jump-to-forward \"%%%\"'",
313329
"bind -Tcopy-mode-vi v send -X rectangle-toggle",
314330
"bind -Tcopy-mode-vi w send -X next-word",
315-
"bind -Tcopy-mode-vi \"{\" send -X previous-paragraph",
316-
"bind -Tcopy-mode-vi \"}\" send -X next-paragraph",
331+
"bind -Tcopy-mode-vi { send -X previous-paragraph",
332+
"bind -Tcopy-mode-vi } send -X next-paragraph",
317333
"bind -Tcopy-mode-vi MouseDown1Pane select-pane",
318334
"bind -Tcopy-mode-vi MouseDrag1Pane select-pane\\; send -X begin-selection",
319335
"bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel",
@@ -343,20 +359,19 @@
343359
if args.tpm:
344360
prefix = 'tmux '
345361
filename += '.tmux'
346-
header = """#!/usr/bin/env bash
362+
header = '''#!/usr/bin/env bash
347363
348364
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
349-
"""
365+
'''
350366

351367
with open(os.path.join(script_dir, filename), 'w') as f:
352368
if args.tpm:
353369
f.write('%s\n' % header)
354370

355-
for option_name in session_options:
371+
options = server_options + session_options + window_options + pane_options
372+
for option_name in options:
356373
f.write('%sset-option -ug %s\n' % (prefix, option_name))
357-
358-
for option_name in window_options:
359-
f.write('%sset-window-option -ug %s\n' % (prefix, option_name))
374+
f.write('%sset-option -u %s\n' % (prefix, option_name))
360375

361376
f.write('%sunbind-key -a\n' % prefix)
362377

0 commit comments

Comments
 (0)