|
7 | 7 |
|
8 | 8 | # Extracted from http://man7.org/linux/man-pages/man1/tmux.1.html#OPTIONS
|
9 | 9 | # Some options are ignored(see commented items)
|
10 |
| -session_options = ( |
| 10 | +server_options = ( |
11 | 11 | 'buffer-limit',
|
12 | 12 | # 'command-alias', # Ignored: is array
|
13 | 13 | 'default-terminal',
|
14 | 14 | 'escape-time',
|
| 15 | + 'exit-empty', |
15 | 16 | 'exit-unattached',
|
16 | 17 | 'focus-events',
|
17 | 18 | 'history-file',
|
18 | 19 | 'message-limit',
|
19 | 20 | 'set-clipboard',
|
20 | 21 | # 'terminal-overrides', # Ignored: is array
|
| 22 | + # 'user-keys', # Ignored: is array |
| 23 | +) |
| 24 | + |
| 25 | +session_options = ( |
21 | 26 | 'activity-action',
|
22 | 27 | 'assume-paste-time',
|
23 | 28 | 'base-index',
|
24 | 29 | 'bell-action',
|
25 | 30 | 'default-command',
|
26 | 31 | # 'default-shell', # Ignored: to set $SHELL correctly
|
| 32 | + 'default-size', |
27 | 33 | 'destroy-unattached',
|
28 | 34 | 'detach-on-destroy',
|
29 | 35 | 'display-panes-active-colour',
|
|
45 | 51 | 'set-titles-string',
|
46 | 52 | 'silence-action',
|
47 | 53 | 'status',
|
| 54 | + # 'status-format' # Ignored: is array |
48 | 55 | 'status-interval',
|
49 | 56 | 'status-justify',
|
50 | 57 | 'status-keys',
|
|
55 | 62 | 'status-right',
|
56 | 63 | 'status-right-length',
|
57 | 64 | 'status-right-style',
|
| 65 | + 'status-style', |
58 | 66 | # 'update-environment', # Ignored: is array
|
59 |
| - # 'user-keys', # Ignored: is array |
60 | 67 | 'visual-activity',
|
61 | 68 | 'visual-bell',
|
62 | 69 | 'visual-silence',
|
|
65 | 72 |
|
66 | 73 | window_options = (
|
67 | 74 | 'aggressive-resize',
|
68 |
| - 'allow-rename', |
69 |
| - 'alternate-screen', |
70 | 75 | 'automatic-rename',
|
71 | 76 | 'automatic-rename-format',
|
72 | 77 | 'clock-mode-colour',
|
73 | 78 | 'clock-mode-style',
|
74 |
| - 'force-height', |
75 |
| - 'force-width', |
76 | 79 | 'main-pane-height',
|
77 | 80 | 'main-pane-width',
|
| 81 | + 'mode-keys', |
78 | 82 | 'mode-style',
|
79 | 83 | 'monitor-activity',
|
80 | 84 | 'monitor-bell',
|
|
86 | 90 | 'pane-border-format',
|
87 | 91 | 'pane-border-status',
|
88 | 92 | 'pane-border-style',
|
89 |
| - 'remain-on-exit', |
90 | 93 | 'synchronize-panes',
|
91 |
| - 'window-active-style', |
92 | 94 | 'window-status-activity-style',
|
93 | 95 | 'window-status-bell-style',
|
94 | 96 | 'window-status-current-format',
|
|
97 | 99 | 'window-status-last-style',
|
98 | 100 | 'window-status-separator',
|
99 | 101 | 'window-status-style',
|
100 |
| - 'window-style', |
| 102 | + 'window-size', |
101 | 103 | 'wrap-search',
|
102 | 104 | 'xterm-keys',
|
103 | 105 | )
|
104 | 106 |
|
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 |
106 | 116 | initial_key_bindings = (
|
107 | 117 | "bind C-b send-prefix",
|
108 | 118 | "bind C-o rotate-window",
|
|
111 | 121 | "bind ! break-pane",
|
112 | 122 | "bind '\"' split-window",
|
113 | 123 | "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", |
117 | 127 | "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 -- '%%'\"", |
121 | 131 | "bind - delete-buffer",
|
122 | 132 | "bind . command-prompt \"move-window -t '%%'\"",
|
123 | 133 | "bind 0 select-window -t:=0",
|
|
132 | 142 | "bind 9 select-window -t:=9",
|
133 | 143 | "bind : command-prompt",
|
134 | 144 | "bind \\; last-pane",
|
135 |
| - "bind = choose-buffer", |
| 145 | + "bind = choose-buffer -Z", |
136 | 146 | "bind ? list-keys",
|
137 |
| - "bind D choose-client", |
| 147 | + "bind D choose-client -Z", |
| 148 | + "bind E select-layout -E", |
138 | 149 | "bind L switch-client -l",
|
139 | 150 | "bind M select-pane -M",
|
140 | 151 | "bind [ copy-mode",
|
141 | 152 | "bind ] paste-buffer",
|
142 | 153 | "bind c new-window",
|
143 | 154 | "bind d detach-client",
|
144 |
| - "bind f command-prompt \"find-window '%%'\"", |
| 155 | + "bind f command-prompt \"find-window -Z -- '%%'\"", |
145 | 156 | "bind i display-message",
|
146 | 157 | "bind l last-window",
|
147 | 158 | "bind m select-pane -m",
|
|
150 | 161 | "bind p previous-window",
|
151 | 162 | "bind q display-panes",
|
152 | 163 | "bind r refresh-client",
|
153 |
| - "bind s choose-tree -s", |
| 164 | + "bind s choose-tree -Zs", |
154 | 165 | "bind t clock-mode",
|
155 |
| - "bind w choose-tree -w", |
| 166 | + "bind w choose-tree -Zw", |
156 | 167 | "bind x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane",
|
157 | 168 | "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", |
160 | 171 | "bind '~' show-messages",
|
161 | 172 | "bind PPage copy-mode -u",
|
162 | 173 | "bind -r Up select-pane -U",
|
|
171 | 182 | "bind M-n next-window -a",
|
172 | 183 | "bind M-o rotate-window -D",
|
173 | 184 | "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", |
174 | 190 | "bind -r M-Up resize-pane -U 5",
|
175 | 191 | "bind -r M-Down resize-pane -D 5",
|
176 | 192 | "bind -r M-Left resize-pane -L 5",
|
|
238 | 254 | "bind -Tcopy-mode M-7 command-prompt -Np'(repeat)' -I7 'send -N \"%%%\"'",
|
239 | 255 | "bind -Tcopy-mode M-8 command-prompt -Np'(repeat)' -I8 'send -N \"%%%\"'",
|
240 | 256 | "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", |
243 | 259 | "bind -Tcopy-mode M-R send -X top-line",
|
244 | 260 | "bind -Tcopy-mode M-b send -X previous-word",
|
245 | 261 | "bind -Tcopy-mode M-f send -X next-word-end",
|
246 | 262 | "bind -Tcopy-mode M-m send -X back-to-indentation",
|
247 | 263 | "bind -Tcopy-mode M-r send -X middle-line",
|
248 | 264 | "bind -Tcopy-mode M-v send -X page-up",
|
249 | 265 | "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", |
252 | 268 | "bind -Tcopy-mode M-Up send -X halfpage-up",
|
253 | 269 | "bind -Tcopy-mode M-Down send -X halfpage-down",
|
254 | 270 | "bind -Tcopy-mode C-Up send -X scroll-up",
|
|
297 | 313 | "bind -Tcopy-mode-vi T command-prompt -1p'(jump to backward)' 'send -X jump-to-backward \"%%%\"'",
|
298 | 314 | "bind -Tcopy-mode-vi V send -X select-line",
|
299 | 315 | "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", |
301 | 317 | "bind -Tcopy-mode-vi b send -X previous-word",
|
302 | 318 | "bind -Tcopy-mode-vi e send -X next-word-end",
|
303 | 319 | "bind -Tcopy-mode-vi f command-prompt -1p'(jump forward)' 'send -X jump-forward \"%%%\"'",
|
|
312 | 328 | "bind -Tcopy-mode-vi t command-prompt -1p'(jump to forward)' 'send -X jump-to-forward \"%%%\"'",
|
313 | 329 | "bind -Tcopy-mode-vi v send -X rectangle-toggle",
|
314 | 330 | "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", |
317 | 333 | "bind -Tcopy-mode-vi MouseDown1Pane select-pane",
|
318 | 334 | "bind -Tcopy-mode-vi MouseDrag1Pane select-pane\\; send -X begin-selection",
|
319 | 335 | "bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-selection-and-cancel",
|
|
343 | 359 | if args.tpm:
|
344 | 360 | prefix = 'tmux '
|
345 | 361 | filename += '.tmux'
|
346 |
| - header = """#!/usr/bin/env bash |
| 362 | + header = '''#!/usr/bin/env bash |
347 | 363 |
|
348 | 364 | CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
349 |
| -""" |
| 365 | +''' |
350 | 366 |
|
351 | 367 | with open(os.path.join(script_dir, filename), 'w') as f:
|
352 | 368 | if args.tpm:
|
353 | 369 | f.write('%s\n' % header)
|
354 | 370 |
|
355 |
| - for option_name in session_options: |
| 371 | + options = server_options + session_options + window_options + pane_options |
| 372 | + for option_name in options: |
356 | 373 | 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)) |
360 | 375 |
|
361 | 376 | f.write('%sunbind-key -a\n' % prefix)
|
362 | 377 |
|
|
0 commit comments