options-table.c revision 1.125
1/* $OpenBSD: options-table.c,v 1.125 2020/05/16 15:24:28 nicm Exp $ */
2
3/*
4 * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <sys/types.h>
20
21#include <string.h>
22#include <paths.h>
23
24#include "tmux.h"
25
26/*
27 * This file has a tables with all the server, session and window
28 * options. These tables are the master copy of the options with their real
29 * (user-visible) types, range limits and default values. At start these are
30 * copied into the runtime global options trees (which only has number and
31 * string types). These tables are then used to look up the real type when the
32 * user sets an option or its value needs to be shown.
33 */
34
35/* Choice option type lists. */
36static const char *options_table_mode_keys_list[] = {
37	"emacs", "vi", NULL
38};
39static const char *options_table_clock_mode_style_list[] = {
40	"12", "24", NULL
41};
42static const char *options_table_status_list[] = {
43	"off", "on", "2", "3", "4", "5", NULL
44};
45static const char *options_table_status_keys_list[] = {
46	"emacs", "vi", NULL
47};
48static const char *options_table_status_justify_list[] = {
49	"left", "centre", "right", NULL
50};
51static const char *options_table_status_position_list[] = {
52	"top", "bottom", NULL
53};
54static const char *options_table_bell_action_list[] = {
55	"none", "any", "current", "other", NULL
56};
57static const char *options_table_visual_bell_list[] = {
58	"off", "on", "both", NULL
59};
60static const char *options_table_pane_status_list[] = {
61	"off", "top", "bottom", NULL
62};
63static const char *options_table_set_clipboard_list[] = {
64	"off", "external", "on", NULL
65};
66static const char *options_table_window_size_list[] = {
67	"largest", "smallest", "manual", "latest", NULL
68};
69
70/* Status line format. */
71#define OPTIONS_TABLE_STATUS_FORMAT1 \
72	"#[align=left range=left #{status-left-style}]" \
73	"#[push-default]" \
74	"#{T;=/#{status-left-length}:status-left}" \
75	"#[pop-default]" \
76	"#[norange default]" \
77	"#[list=on align=#{status-justify}]" \
78	"#[list=left-marker]<#[list=right-marker]>#[list=on]" \
79	"#{W:" \
80		"#[range=window|#{window_index} " \
81			"#{window-status-style}" \
82			"#{?#{&&:#{window_last_flag}," \
83				"#{!=:#{window-status-last-style},default}}, " \
84				"#{window-status-last-style}," \
85			"}" \
86			"#{?#{&&:#{window_bell_flag}," \
87				"#{!=:#{window-status-bell-style},default}}, " \
88				"#{window-status-bell-style}," \
89				"#{?#{&&:#{||:#{window_activity_flag}," \
90					     "#{window_silence_flag}}," \
91					"#{!=:" \
92					"#{window-status-activity-style}," \
93					"default}}, " \
94					"#{window-status-activity-style}," \
95				"}" \
96			"}" \
97		"]" \
98		"#[push-default]" \
99		"#{T:window-status-format}" \
100		"#[pop-default]" \
101		"#[norange default]" \
102		"#{?window_end_flag,,#{window-status-separator}}" \
103	"," \
104		"#[range=window|#{window_index} list=focus " \
105			"#{?#{!=:#{window-status-current-style},default}," \
106	                        "#{window-status-current-style}," \
107	                        "#{window-status-style}" \
108	                "}" \
109			"#{?#{&&:#{window_last_flag}," \
110				"#{!=:#{window-status-last-style},default}}, " \
111				"#{window-status-last-style}," \
112			"}" \
113			"#{?#{&&:#{window_bell_flag}," \
114				"#{!=:#{window-status-bell-style},default}}, " \
115				"#{window-status-bell-style}," \
116				"#{?#{&&:#{||:#{window_activity_flag}," \
117					     "#{window_silence_flag}}," \
118					"#{!=:" \
119					"#{window-status-activity-style}," \
120					"default}}, " \
121					"#{window-status-activity-style}," \
122				"}" \
123			"}" \
124		"]" \
125		"#[push-default]" \
126		"#{T:window-status-current-format}" \
127		"#[pop-default]" \
128		"#[norange list=on default]" \
129		"#{?window_end_flag,,#{window-status-separator}}" \
130	"}" \
131	"#[nolist align=right range=right #{status-right-style}]" \
132	"#[push-default]" \
133	"#{T;=/#{status-right-length}:status-right}" \
134	"#[pop-default]" \
135	"#[norange default]"
136#define OPTIONS_TABLE_STATUS_FORMAT2 \
137	"#[align=centre]#{P:#{?pane_active,#[reverse],}" \
138	"#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
139static const char *options_table_status_format_default[] = {
140	OPTIONS_TABLE_STATUS_FORMAT1, OPTIONS_TABLE_STATUS_FORMAT2, NULL
141};
142
143/* Helpers for hook options. */
144#define OPTIONS_TABLE_HOOK(hook_name, default_value) \
145	{ .name = hook_name, \
146	  .type = OPTIONS_TABLE_COMMAND, \
147	  .scope = OPTIONS_TABLE_SESSION, \
148	  .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
149	  .default_str = default_value,	\
150	  .separator = "" \
151	}
152
153#define OPTIONS_TABLE_PANE_HOOK(hook_name, default_value) \
154	{ .name = hook_name, \
155	  .type = OPTIONS_TABLE_COMMAND, \
156	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, \
157	  .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
158	  .default_str = default_value,	\
159	  .separator = "" \
160	}
161
162#define OPTIONS_TABLE_WINDOW_HOOK(hook_name, default_value) \
163	{ .name = hook_name, \
164	  .type = OPTIONS_TABLE_COMMAND, \
165	  .scope = OPTIONS_TABLE_WINDOW, \
166	  .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
167	  .default_str = default_value,	\
168	  .separator = "" \
169	}
170
171/* Top-level options. */
172const struct options_table_entry options_table[] = {
173	/* Server options. */
174	{ .name = "backspace",
175	  .type = OPTIONS_TABLE_KEY,
176	  .scope = OPTIONS_TABLE_SERVER,
177	  .default_num = '\177',
178	},
179
180	{ .name = "buffer-limit",
181	  .type = OPTIONS_TABLE_NUMBER,
182	  .scope = OPTIONS_TABLE_SERVER,
183	  .minimum = 1,
184	  .maximum = INT_MAX,
185	  .default_num = 50
186	},
187
188	{ .name = "command-alias",
189	  .type = OPTIONS_TABLE_STRING,
190	  .scope = OPTIONS_TABLE_SERVER,
191	  .flags = OPTIONS_TABLE_IS_ARRAY,
192	  .default_str = "split-pane=split-window,"
193			 "splitp=split-window,"
194			 "server-info=show-messages -JT,"
195			 "info=show-messages -JT,"
196			 "choose-window=choose-tree -w,"
197			 "choose-session=choose-tree -s",
198	  .separator = ","
199	},
200
201	{ .name = "copy-command",
202	  .type = OPTIONS_TABLE_STRING,
203	  .scope = OPTIONS_TABLE_SERVER,
204	  .default_str = ""
205	},
206
207	{ .name = "default-terminal",
208	  .type = OPTIONS_TABLE_STRING,
209	  .scope = OPTIONS_TABLE_SERVER,
210	  .default_str = "screen"
211	},
212
213	{ .name = "editor",
214	  .type = OPTIONS_TABLE_STRING,
215	  .scope = OPTIONS_TABLE_SERVER,
216	  .default_str = _PATH_VI
217	},
218
219	{ .name = "escape-time",
220	  .type = OPTIONS_TABLE_NUMBER,
221	  .scope = OPTIONS_TABLE_SERVER,
222	  .minimum = 0,
223	  .maximum = INT_MAX,
224	  .default_num = 500
225	},
226
227	{ .name = "exit-empty",
228	  .type = OPTIONS_TABLE_FLAG,
229	  .scope = OPTIONS_TABLE_SERVER,
230	  .default_num = 1
231	},
232
233	{ .name = "exit-unattached",
234	  .type = OPTIONS_TABLE_FLAG,
235	  .scope = OPTIONS_TABLE_SERVER,
236	  .default_num = 0
237	},
238
239	{ .name = "focus-events",
240	  .type = OPTIONS_TABLE_FLAG,
241	  .scope = OPTIONS_TABLE_SERVER,
242	  .default_num = 0
243	},
244
245	{ .name = "history-file",
246	  .type = OPTIONS_TABLE_STRING,
247	  .scope = OPTIONS_TABLE_SERVER,
248	  .default_str = ""
249	},
250
251	{ .name = "message-limit",
252	  .type = OPTIONS_TABLE_NUMBER,
253	  .scope = OPTIONS_TABLE_SERVER,
254	  .minimum = 0,
255	  .maximum = INT_MAX,
256	  .default_num = 100
257	},
258
259	{ .name = "set-clipboard",
260	  .type = OPTIONS_TABLE_CHOICE,
261	  .scope = OPTIONS_TABLE_SERVER,
262	  .choices = options_table_set_clipboard_list,
263	  .default_num = 1
264	},
265
266	{ .name = "terminal-overrides",
267	  .type = OPTIONS_TABLE_STRING,
268	  .scope = OPTIONS_TABLE_SERVER,
269	  .flags = OPTIONS_TABLE_IS_ARRAY,
270	  .default_str = "",
271	  .separator = ","
272	},
273
274	{ .name = "terminal-features",
275	  .type = OPTIONS_TABLE_STRING,
276	  .scope = OPTIONS_TABLE_SERVER,
277	  .flags = OPTIONS_TABLE_IS_ARRAY,
278	  .default_str = "xterm*:clipboard:ccolour:cstyle:title,"
279	                 "screen*:title",
280	  .separator = ","
281	},
282
283	{ .name = "user-keys",
284	  .type = OPTIONS_TABLE_STRING,
285	  .scope = OPTIONS_TABLE_SERVER,
286	  .flags = OPTIONS_TABLE_IS_ARRAY,
287	  .default_str = "",
288	  .separator = ","
289	},
290
291	/* Session options. */
292	{ .name = "activity-action",
293	  .type = OPTIONS_TABLE_CHOICE,
294	  .scope = OPTIONS_TABLE_SESSION,
295	  .choices = options_table_bell_action_list,
296	  .default_num = ALERT_OTHER
297	},
298
299	{ .name = "assume-paste-time",
300	  .type = OPTIONS_TABLE_NUMBER,
301	  .scope = OPTIONS_TABLE_SESSION,
302	  .minimum = 0,
303	  .maximum = INT_MAX,
304	  .default_num = 1,
305	},
306
307	{ .name = "base-index",
308	  .type = OPTIONS_TABLE_NUMBER,
309	  .scope = OPTIONS_TABLE_SESSION,
310	  .minimum = 0,
311	  .maximum = INT_MAX,
312	  .default_num = 0
313	},
314
315	{ .name = "bell-action",
316	  .type = OPTIONS_TABLE_CHOICE,
317	  .scope = OPTIONS_TABLE_SESSION,
318	  .choices = options_table_bell_action_list,
319	  .default_num = ALERT_ANY
320	},
321
322	{ .name = "default-command",
323	  .type = OPTIONS_TABLE_STRING,
324	  .scope = OPTIONS_TABLE_SESSION,
325	  .default_str = ""
326	},
327
328	{ .name = "default-shell",
329	  .type = OPTIONS_TABLE_STRING,
330	  .scope = OPTIONS_TABLE_SESSION,
331	  .default_str = _PATH_BSHELL
332	},
333
334	{ .name = "default-size",
335	  .type = OPTIONS_TABLE_STRING,
336	  .scope = OPTIONS_TABLE_SESSION,
337	  .pattern = "[0-9]*x[0-9]*",
338	  .default_str = "80x24"
339	},
340
341	{ .name = "destroy-unattached",
342	  .type = OPTIONS_TABLE_FLAG,
343	  .scope = OPTIONS_TABLE_SESSION,
344	  .default_num = 0
345	},
346
347	{ .name = "detach-on-destroy",
348	  .type = OPTIONS_TABLE_FLAG,
349	  .scope = OPTIONS_TABLE_SESSION,
350	  .default_num = 1
351	},
352
353	{ .name = "display-panes-active-colour",
354	  .type = OPTIONS_TABLE_COLOUR,
355	  .scope = OPTIONS_TABLE_SESSION,
356	  .default_num = 1
357	},
358
359	{ .name = "display-panes-colour",
360	  .type = OPTIONS_TABLE_COLOUR,
361	  .scope = OPTIONS_TABLE_SESSION,
362	  .default_num = 4
363	},
364
365	{ .name = "display-panes-time",
366	  .type = OPTIONS_TABLE_NUMBER,
367	  .scope = OPTIONS_TABLE_SESSION,
368	  .minimum = 1,
369	  .maximum = INT_MAX,
370	  .default_num = 1000
371	},
372
373	{ .name = "display-time",
374	  .type = OPTIONS_TABLE_NUMBER,
375	  .scope = OPTIONS_TABLE_SESSION,
376	  .minimum = 0,
377	  .maximum = INT_MAX,
378	  .default_num = 750
379	},
380
381	{ .name = "history-limit",
382	  .type = OPTIONS_TABLE_NUMBER,
383	  .scope = OPTIONS_TABLE_SESSION,
384	  .minimum = 0,
385	  .maximum = INT_MAX,
386	  .default_num = 2000
387	},
388
389	{ .name = "key-table",
390	  .type = OPTIONS_TABLE_STRING,
391	  .scope = OPTIONS_TABLE_SESSION,
392	  .default_str = "root"
393	},
394
395	{ .name = "lock-after-time",
396	  .type = OPTIONS_TABLE_NUMBER,
397	  .scope = OPTIONS_TABLE_SESSION,
398	  .minimum = 0,
399	  .maximum = INT_MAX,
400	  .default_num = 0
401	},
402
403	{ .name = "lock-command",
404	  .type = OPTIONS_TABLE_STRING,
405	  .scope = OPTIONS_TABLE_SESSION,
406	  .default_str = "lock -np"
407	},
408
409	{ .name = "message-command-style",
410	  .type = OPTIONS_TABLE_STRING,
411	  .scope = OPTIONS_TABLE_SESSION,
412	  .default_str = "bg=black,fg=yellow",
413	  .flags = OPTIONS_TABLE_IS_STYLE,
414	  .separator = ","
415	},
416
417	{ .name = "message-style",
418	  .type = OPTIONS_TABLE_STRING,
419	  .scope = OPTIONS_TABLE_SESSION,
420	  .default_str = "bg=yellow,fg=black",
421	  .flags = OPTIONS_TABLE_IS_STYLE,
422	  .separator = ","
423	},
424
425	{ .name = "mouse",
426	  .type = OPTIONS_TABLE_FLAG,
427	  .scope = OPTIONS_TABLE_SESSION,
428	  .default_num = 0
429	},
430
431	{ .name = "prefix",
432	  .type = OPTIONS_TABLE_KEY,
433	  .scope = OPTIONS_TABLE_SESSION,
434	  .default_num = '\002',
435	},
436
437	{ .name = "prefix2",
438	  .type = OPTIONS_TABLE_KEY,
439	  .scope = OPTIONS_TABLE_SESSION,
440	  .default_num = KEYC_NONE,
441	},
442
443	{ .name = "renumber-windows",
444	  .type = OPTIONS_TABLE_FLAG,
445	  .scope = OPTIONS_TABLE_SESSION,
446	  .default_num = 0
447	},
448
449	{ .name = "repeat-time",
450	  .type = OPTIONS_TABLE_NUMBER,
451	  .scope = OPTIONS_TABLE_SESSION,
452	  .minimum = 0,
453	  .maximum = SHRT_MAX,
454	  .default_num = 500
455	},
456
457	{ .name = "set-titles",
458	  .type = OPTIONS_TABLE_FLAG,
459	  .scope = OPTIONS_TABLE_SESSION,
460	  .default_num = 0
461	},
462
463	{ .name = "set-titles-string",
464	  .type = OPTIONS_TABLE_STRING,
465	  .scope = OPTIONS_TABLE_SESSION,
466	  .default_str = "#S:#I:#W - \"#T\" #{session_alerts}"
467	},
468
469	{ .name = "silence-action",
470	  .type = OPTIONS_TABLE_CHOICE,
471	  .scope = OPTIONS_TABLE_SESSION,
472	  .choices = options_table_bell_action_list,
473	  .default_num = ALERT_OTHER
474	},
475
476	{ .name = "status",
477	  .type = OPTIONS_TABLE_CHOICE,
478	  .scope = OPTIONS_TABLE_SESSION,
479	  .choices = options_table_status_list,
480	  .default_num = 1
481	},
482
483	{ .name = "status-bg",
484	  .type = OPTIONS_TABLE_COLOUR,
485	  .scope = OPTIONS_TABLE_SESSION,
486	  .default_num = 8,
487	},
488
489	{ .name = "status-fg",
490	  .type = OPTIONS_TABLE_COLOUR,
491	  .scope = OPTIONS_TABLE_SESSION,
492	  .default_num = 8,
493	},
494
495	{ .name = "status-format",
496	  .type = OPTIONS_TABLE_STRING,
497	  .scope = OPTIONS_TABLE_SESSION,
498	  .flags = OPTIONS_TABLE_IS_ARRAY,
499	  .default_arr = options_table_status_format_default,
500	},
501
502	{ .name = "status-interval",
503	  .type = OPTIONS_TABLE_NUMBER,
504	  .scope = OPTIONS_TABLE_SESSION,
505	  .minimum = 0,
506	  .maximum = INT_MAX,
507	  .default_num = 15
508	},
509
510	{ .name = "status-justify",
511	  .type = OPTIONS_TABLE_CHOICE,
512	  .scope = OPTIONS_TABLE_SESSION,
513	  .choices = options_table_status_justify_list,
514	  .default_num = 0
515	},
516
517	{ .name = "status-keys",
518	  .type = OPTIONS_TABLE_CHOICE,
519	  .scope = OPTIONS_TABLE_SESSION,
520	  .choices = options_table_status_keys_list,
521	  .default_num = MODEKEY_EMACS
522	},
523
524	{ .name = "status-left",
525	  .type = OPTIONS_TABLE_STRING,
526	  .scope = OPTIONS_TABLE_SESSION,
527	  .default_str = "[#S] "
528	},
529
530	{ .name = "status-left-length",
531	  .type = OPTIONS_TABLE_NUMBER,
532	  .scope = OPTIONS_TABLE_SESSION,
533	  .minimum = 0,
534	  .maximum = SHRT_MAX,
535	  .default_num = 10
536	},
537
538	{ .name = "status-left-style",
539	  .type = OPTIONS_TABLE_STRING,
540	  .scope = OPTIONS_TABLE_SESSION,
541	  .default_str = "default",
542	  .flags = OPTIONS_TABLE_IS_STYLE,
543	  .separator = ","
544	},
545
546	{ .name = "status-position",
547	  .type = OPTIONS_TABLE_CHOICE,
548	  .scope = OPTIONS_TABLE_SESSION,
549	  .choices = options_table_status_position_list,
550	  .default_num = 1
551	},
552
553	{ .name = "status-right",
554	  .type = OPTIONS_TABLE_STRING,
555	  .scope = OPTIONS_TABLE_SESSION,
556	  .default_str = "#{?window_bigger,"
557	                 "[#{window_offset_x}#,#{window_offset_y}] ,}"
558	                 "\"#{=21:pane_title}\" %H:%M %d-%b-%y"
559	},
560
561	{ .name = "status-right-length",
562	  .type = OPTIONS_TABLE_NUMBER,
563	  .scope = OPTIONS_TABLE_SESSION,
564	  .minimum = 0,
565	  .maximum = SHRT_MAX,
566	  .default_num = 40
567	},
568
569	{ .name = "status-right-style",
570	  .type = OPTIONS_TABLE_STRING,
571	  .scope = OPTIONS_TABLE_SESSION,
572	  .default_str = "default",
573	  .flags = OPTIONS_TABLE_IS_STYLE,
574	  .separator = ","
575	},
576
577	{ .name = "status-style",
578	  .type = OPTIONS_TABLE_STRING,
579	  .scope = OPTIONS_TABLE_SESSION,
580	  .default_str = "bg=green,fg=black",
581	  .flags = OPTIONS_TABLE_IS_STYLE,
582	  .separator = ","
583	},
584
585	{ .name = "update-environment",
586	  .type = OPTIONS_TABLE_STRING,
587	  .scope = OPTIONS_TABLE_SESSION,
588	  .flags = OPTIONS_TABLE_IS_ARRAY,
589	  .default_str = "DISPLAY KRB5CCNAME SSH_ASKPASS SSH_AUTH_SOCK "
590	  		 "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
591	},
592
593	{ .name = "visual-activity",
594	  .type = OPTIONS_TABLE_CHOICE,
595	  .scope = OPTIONS_TABLE_SESSION,
596	  .choices = options_table_visual_bell_list,
597	  .default_num = VISUAL_OFF
598	},
599
600	{ .name = "visual-bell",
601	  .type = OPTIONS_TABLE_CHOICE,
602	  .scope = OPTIONS_TABLE_SESSION,
603	  .choices = options_table_visual_bell_list,
604	  .default_num = VISUAL_OFF
605	},
606
607	{ .name = "visual-silence",
608	  .type = OPTIONS_TABLE_CHOICE,
609	  .scope = OPTIONS_TABLE_SESSION,
610	  .choices = options_table_visual_bell_list,
611	  .default_num = VISUAL_OFF
612	},
613
614	{ .name = "word-separators",
615	  .type = OPTIONS_TABLE_STRING,
616	  .scope = OPTIONS_TABLE_SESSION,
617	  .default_str = " "
618	},
619
620	/* Window options. */
621	{ .name = "aggressive-resize",
622	  .type = OPTIONS_TABLE_FLAG,
623	  .scope = OPTIONS_TABLE_WINDOW,
624	  .default_num = 0
625	},
626
627	{ .name = "allow-rename",
628	  .type = OPTIONS_TABLE_FLAG,
629	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
630	  .default_num = 0
631	},
632
633	{ .name = "alternate-screen",
634	  .type = OPTIONS_TABLE_FLAG,
635	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
636	  .default_num = 1
637	},
638
639	{ .name = "automatic-rename",
640	  .type = OPTIONS_TABLE_FLAG,
641	  .scope = OPTIONS_TABLE_WINDOW,
642	  .default_num = 1
643	},
644
645	{ .name = "automatic-rename-format",
646	  .type = OPTIONS_TABLE_STRING,
647	  .scope = OPTIONS_TABLE_WINDOW,
648	  .default_str = "#{?pane_in_mode,[tmux],#{pane_current_command}}"
649			 "#{?pane_dead,[dead],}"
650	},
651
652	{ .name = "clock-mode-colour",
653	  .type = OPTIONS_TABLE_COLOUR,
654	  .scope = OPTIONS_TABLE_WINDOW,
655	  .default_num = 4
656	},
657
658	{ .name = "clock-mode-style",
659	  .type = OPTIONS_TABLE_CHOICE,
660	  .scope = OPTIONS_TABLE_WINDOW,
661	  .choices = options_table_clock_mode_style_list,
662	  .default_num = 1
663	},
664
665	{ .name = "copy-mode-match-style",
666	  .type = OPTIONS_TABLE_STRING,
667	  .scope = OPTIONS_TABLE_WINDOW,
668	  .default_str = "bg=cyan,fg=black",
669	  .flags = OPTIONS_TABLE_IS_STYLE,
670	  .separator = ","
671	},
672
673	{ .name = "copy-mode-current-match-style",
674	  .type = OPTIONS_TABLE_STRING,
675	  .scope = OPTIONS_TABLE_WINDOW,
676	  .default_str = "bg=magenta,fg=black",
677	  .flags = OPTIONS_TABLE_IS_STYLE,
678	  .separator = ","
679	},
680
681	{ .name = "main-pane-height",
682	  .type = OPTIONS_TABLE_STRING,
683	  .scope = OPTIONS_TABLE_WINDOW,
684	  .default_str = "24"
685	},
686
687	{ .name = "main-pane-width",
688	  .type = OPTIONS_TABLE_STRING,
689	  .scope = OPTIONS_TABLE_WINDOW,
690	  .default_str = "80"
691	},
692
693	{ .name = "mode-keys",
694	  .type = OPTIONS_TABLE_CHOICE,
695	  .scope = OPTIONS_TABLE_WINDOW,
696	  .choices = options_table_mode_keys_list,
697	  .default_num = MODEKEY_EMACS
698	},
699
700	{ .name = "mode-style",
701	  .type = OPTIONS_TABLE_STRING,
702	  .scope = OPTIONS_TABLE_WINDOW,
703	  .default_str = "bg=yellow,fg=black",
704	  .flags = OPTIONS_TABLE_IS_STYLE,
705	  .separator = ","
706	},
707
708	{ .name = "monitor-activity",
709	  .type = OPTIONS_TABLE_FLAG,
710	  .scope = OPTIONS_TABLE_WINDOW,
711	  .default_num = 0
712	},
713
714	{ .name = "monitor-bell",
715	  .type = OPTIONS_TABLE_FLAG,
716	  .scope = OPTIONS_TABLE_WINDOW,
717	  .default_num = 1
718	},
719
720	{ .name = "monitor-silence",
721	  .type = OPTIONS_TABLE_NUMBER,
722	  .scope = OPTIONS_TABLE_WINDOW,
723	  .minimum = 0,
724	  .maximum = INT_MAX,
725	  .default_num = 0
726	},
727
728	{ .name = "other-pane-height",
729	  .type = OPTIONS_TABLE_STRING,
730	  .scope = OPTIONS_TABLE_WINDOW,
731	  .default_str = "0"
732	},
733
734	{ .name = "other-pane-width",
735	  .type = OPTIONS_TABLE_STRING,
736	  .scope = OPTIONS_TABLE_WINDOW,
737	  .default_str = "0"
738	},
739
740	{ .name = "pane-active-border-style",
741	  .type = OPTIONS_TABLE_STRING,
742	  .scope = OPTIONS_TABLE_WINDOW,
743	  .default_str = "#{?pane_in_mode,fg=yellow,#{?synchronize-panes,fg=red,fg=green}}",
744	  .flags = OPTIONS_TABLE_IS_STYLE,
745	  .separator = ","
746	},
747
748	{ .name = "pane-base-index",
749	  .type = OPTIONS_TABLE_NUMBER,
750	  .scope = OPTIONS_TABLE_WINDOW,
751	  .minimum = 0,
752	  .maximum = USHRT_MAX,
753	  .default_num = 0
754	},
755
756	{ .name = "pane-border-format",
757	  .type = OPTIONS_TABLE_STRING,
758	  .scope = OPTIONS_TABLE_WINDOW,
759	  .default_str = "#{?pane_active,#[reverse],}#{pane_index}#[default] "
760			 "\"#{pane_title}\""
761	},
762
763	{ .name = "pane-border-status",
764	  .type = OPTIONS_TABLE_CHOICE,
765	  .scope = OPTIONS_TABLE_WINDOW,
766	  .choices = options_table_pane_status_list,
767	  .default_num = PANE_STATUS_OFF
768	},
769
770	{ .name = "pane-border-style",
771	  .type = OPTIONS_TABLE_STRING,
772	  .scope = OPTIONS_TABLE_WINDOW,
773	  .default_str = "default",
774	  .flags = OPTIONS_TABLE_IS_STYLE,
775	  .separator = ","
776	},
777
778	{ .name = "remain-on-exit",
779	  .type = OPTIONS_TABLE_FLAG,
780	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
781	  .default_num = 0
782	},
783
784	{ .name = "synchronize-panes",
785	  .type = OPTIONS_TABLE_FLAG,
786	  .scope = OPTIONS_TABLE_WINDOW,
787	  .default_num = 0
788	},
789
790	{ .name = "window-active-style",
791	  .type = OPTIONS_TABLE_STRING,
792	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
793	  .default_str = "default",
794	  .flags = OPTIONS_TABLE_IS_STYLE,
795	  .separator = ","
796	},
797
798	{ .name = "window-size",
799	  .type = OPTIONS_TABLE_CHOICE,
800	  .scope = OPTIONS_TABLE_WINDOW,
801	  .choices = options_table_window_size_list,
802	  .default_num = WINDOW_SIZE_LATEST
803	},
804
805	{ .name = "window-style",
806	  .type = OPTIONS_TABLE_STRING,
807	  .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
808	  .default_str = "default",
809	  .flags = OPTIONS_TABLE_IS_STYLE,
810	  .separator = ","
811	},
812
813	{ .name = "window-status-activity-style",
814	  .type = OPTIONS_TABLE_STRING,
815	  .scope = OPTIONS_TABLE_WINDOW,
816	  .default_str = "reverse",
817	  .flags = OPTIONS_TABLE_IS_STYLE,
818	  .separator = ","
819	},
820
821	{ .name = "window-status-bell-style",
822	  .type = OPTIONS_TABLE_STRING,
823	  .scope = OPTIONS_TABLE_WINDOW,
824	  .default_str = "reverse",
825	  .flags = OPTIONS_TABLE_IS_STYLE,
826	  .separator = ","
827	},
828
829	{ .name = "window-status-current-format",
830	  .type = OPTIONS_TABLE_STRING,
831	  .scope = OPTIONS_TABLE_WINDOW,
832	  .default_str = "#I:#W#{?window_flags,#{window_flags}, }"
833	},
834
835	{ .name = "window-status-current-style",
836	  .type = OPTIONS_TABLE_STRING,
837	  .scope = OPTIONS_TABLE_WINDOW,
838	  .default_str = "default",
839	  .flags = OPTIONS_TABLE_IS_STYLE,
840	  .separator = ","
841	},
842
843	{ .name = "window-status-format",
844	  .type = OPTIONS_TABLE_STRING,
845	  .scope = OPTIONS_TABLE_WINDOW,
846	  .default_str = "#I:#W#{?window_flags,#{window_flags}, }"
847	},
848
849	{ .name = "window-status-last-style",
850	  .type = OPTIONS_TABLE_STRING,
851	  .scope = OPTIONS_TABLE_WINDOW,
852	  .default_str = "default",
853	  .flags = OPTIONS_TABLE_IS_STYLE,
854	  .separator = ","
855	},
856
857	{ .name = "window-status-separator",
858	  .type = OPTIONS_TABLE_STRING,
859	  .scope = OPTIONS_TABLE_WINDOW,
860	  .default_str = " "
861	},
862
863	{ .name = "window-status-style",
864	  .type = OPTIONS_TABLE_STRING,
865	  .scope = OPTIONS_TABLE_WINDOW,
866	  .default_str = "default",
867	  .flags = OPTIONS_TABLE_IS_STYLE,
868	  .separator = ","
869	},
870
871	{ .name = "wrap-search",
872	  .type = OPTIONS_TABLE_FLAG,
873	  .scope = OPTIONS_TABLE_WINDOW,
874	  .default_num = 1
875	},
876
877	{ .name = "xterm-keys",
878	  .type = OPTIONS_TABLE_FLAG,
879	  .scope = OPTIONS_TABLE_WINDOW,
880	  .default_num = 1
881	},
882
883	/* Hook options. */
884	OPTIONS_TABLE_HOOK("after-bind-key", ""),
885	OPTIONS_TABLE_HOOK("after-capture-pane", ""),
886	OPTIONS_TABLE_HOOK("after-copy-mode", ""),
887	OPTIONS_TABLE_HOOK("after-display-message", ""),
888	OPTIONS_TABLE_HOOK("after-display-panes", ""),
889	OPTIONS_TABLE_HOOK("after-kill-pane", ""),
890	OPTIONS_TABLE_HOOK("after-list-buffers", ""),
891	OPTIONS_TABLE_HOOK("after-list-clients", ""),
892	OPTIONS_TABLE_HOOK("after-list-keys", ""),
893	OPTIONS_TABLE_HOOK("after-list-panes", ""),
894	OPTIONS_TABLE_HOOK("after-list-sessions", ""),
895	OPTIONS_TABLE_HOOK("after-list-windows", ""),
896	OPTIONS_TABLE_HOOK("after-load-buffer", ""),
897	OPTIONS_TABLE_HOOK("after-lock-server", ""),
898	OPTIONS_TABLE_HOOK("after-new-session", ""),
899	OPTIONS_TABLE_HOOK("after-new-window", ""),
900	OPTIONS_TABLE_HOOK("after-paste-buffer", ""),
901	OPTIONS_TABLE_HOOK("after-pipe-pane", ""),
902	OPTIONS_TABLE_HOOK("after-queue", ""),
903	OPTIONS_TABLE_HOOK("after-refresh-client", ""),
904	OPTIONS_TABLE_HOOK("after-rename-session", ""),
905	OPTIONS_TABLE_HOOK("after-rename-window", ""),
906	OPTIONS_TABLE_HOOK("after-resize-pane", ""),
907	OPTIONS_TABLE_HOOK("after-resize-window", ""),
908	OPTIONS_TABLE_HOOK("after-save-buffer", ""),
909	OPTIONS_TABLE_HOOK("after-select-layout", ""),
910	OPTIONS_TABLE_HOOK("after-select-pane", ""),
911	OPTIONS_TABLE_HOOK("after-select-window", ""),
912	OPTIONS_TABLE_HOOK("after-send-keys", ""),
913	OPTIONS_TABLE_HOOK("after-set-buffer", ""),
914	OPTIONS_TABLE_HOOK("after-set-environment", ""),
915	OPTIONS_TABLE_HOOK("after-set-hook", ""),
916	OPTIONS_TABLE_HOOK("after-set-option", ""),
917	OPTIONS_TABLE_HOOK("after-show-environment", ""),
918	OPTIONS_TABLE_HOOK("after-show-messages", ""),
919	OPTIONS_TABLE_HOOK("after-show-options", ""),
920	OPTIONS_TABLE_HOOK("after-split-window", ""),
921	OPTIONS_TABLE_HOOK("after-unbind-key", ""),
922	OPTIONS_TABLE_HOOK("alert-activity", ""),
923	OPTIONS_TABLE_HOOK("alert-bell", ""),
924	OPTIONS_TABLE_HOOK("alert-silence", ""),
925	OPTIONS_TABLE_HOOK("client-attached", ""),
926	OPTIONS_TABLE_HOOK("client-detached", ""),
927	OPTIONS_TABLE_HOOK("client-resized", ""),
928	OPTIONS_TABLE_HOOK("client-session-changed", ""),
929	OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
930	OPTIONS_TABLE_PANE_HOOK("pane-exited", ""),
931	OPTIONS_TABLE_PANE_HOOK("pane-focus-in", ""),
932	OPTIONS_TABLE_PANE_HOOK("pane-focus-out", ""),
933	OPTIONS_TABLE_PANE_HOOK("pane-mode-changed", ""),
934	OPTIONS_TABLE_PANE_HOOK("pane-set-clipboard", ""),
935	OPTIONS_TABLE_HOOK("session-closed", ""),
936	OPTIONS_TABLE_HOOK("session-created", ""),
937	OPTIONS_TABLE_HOOK("session-renamed", ""),
938	OPTIONS_TABLE_HOOK("session-window-changed", ""),
939	OPTIONS_TABLE_WINDOW_HOOK("window-layout-changed", ""),
940	OPTIONS_TABLE_WINDOW_HOOK("window-linked", ""),
941	OPTIONS_TABLE_WINDOW_HOOK("window-pane-changed", ""),
942	OPTIONS_TABLE_WINDOW_HOOK("window-renamed", ""),
943	OPTIONS_TABLE_WINDOW_HOOK("window-unlinked", ""),
944
945	{ .name = NULL }
946};
947