diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-10-20 22:29:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-10-20 22:29:26 +0000 |
commit | 6a03409cc59f0b40c757f05b189b87514954c261 (patch) | |
tree | 1c8ad4db5aa29cf0fe2931b32432e50a5c7847fd | |
parent | 3c930296a8989d2aeae7ddc9e3db46826418cf56 (diff) |
Instead of setting up the default keys by building the key struct
directly with a helper function in the cmd_entry, include a table of
bind-key commands and pass them through the command parser and a
temporary cmd_q.
As well as being smaller, this will allow default bindings to be command
sequences which will probably be needed soon.
68 files changed, 154 insertions, 471 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 3b8d6104c95..77d8082cc3e 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.30 2014/02/23 00:53:06 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.31 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -37,7 +37,6 @@ const struct cmd_entry cmd_attach_session_entry = { "c:drt:", 0, 0, "[-dr] [-c working-directory] " CMD_TARGET_SESSION_USAGE, CMD_CANTNEST|CMD_STARTSERVER, - NULL, cmd_attach_session_exec }; diff --git a/usr.bin/tmux/cmd-bind-key.c b/usr.bin/tmux/cmd-bind-key.c index 7127cb9fcca..243741fbd4a 100644 --- a/usr.bin/tmux/cmd-bind-key.c +++ b/usr.bin/tmux/cmd-bind-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-bind-key.c,v 1.18 2014/05/14 06:45:35 nicm Exp $ */ +/* $OpenBSD: cmd-bind-key.c,v 1.19 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_bind_key_entry = { "cnrt:", 1, -1, "[-cnr] [-t mode-table] key command [arguments]", 0, - NULL, cmd_bind_key_exec }; diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c index a4d63da717a..6e16fad2d05 100644 --- a/usr.bin/tmux/cmd-break-pane.c +++ b/usr.bin/tmux/cmd-break-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-break-pane.c,v 1.23 2014/04/17 09:13:13 nicm Exp $ */ +/* $OpenBSD: cmd-break-pane.c,v 1.24 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_break_pane_entry = { "dPF:t:", 0, 0, "[-dP] [-F format] " CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_break_pane_exec }; diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index f9f5682c35b..54239daa7ac 100644 --- a/usr.bin/tmux/cmd-capture-pane.c +++ b/usr.bin/tmux/cmd-capture-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-capture-pane.c,v 1.29 2014/10/08 17:35:58 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.30 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -41,7 +41,6 @@ const struct cmd_entry cmd_capture_pane_entry = { "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] [-S start-line]" CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_capture_pane_exec }; diff --git a/usr.bin/tmux/cmd-choose-buffer.c b/usr.bin/tmux/cmd-choose-buffer.c index bd269d6441c..2595c865911 100644 --- a/usr.bin/tmux/cmd-choose-buffer.c +++ b/usr.bin/tmux/cmd-choose-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-buffer.c,v 1.18 2014/05/13 07:34:35 nicm Exp $ */ +/* $OpenBSD: cmd-choose-buffer.c,v 1.19 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_choose_buffer_entry = { "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE " [-F format] [template]", 0, - NULL, cmd_choose_buffer_exec }; diff --git a/usr.bin/tmux/cmd-choose-client.c b/usr.bin/tmux/cmd-choose-client.c index 0da248d02f3..8c1e9b32152 100644 --- a/usr.bin/tmux/cmd-choose-client.c +++ b/usr.bin/tmux/cmd-choose-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-client.c,v 1.19 2013/10/10 12:00:18 nicm Exp $ */ +/* $OpenBSD: cmd-choose-client.c,v 1.20 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_choose_client_entry = { "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE " [-F format] [template]", 0, - NULL, cmd_choose_client_exec }; diff --git a/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c index 9073dd48848..29cabe22754 100644 --- a/usr.bin/tmux/cmd-choose-tree.c +++ b/usr.bin/tmux/cmd-choose-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-tree.c,v 1.25 2013/10/10 12:00:18 nicm Exp $ */ +/* $OpenBSD: cmd-choose-tree.c,v 1.26 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam <thomas@xteddy.org> @@ -40,7 +40,6 @@ const struct cmd_entry cmd_choose_tree_entry = { "[-suw] [-b session-template] [-c window template] [-S format] " \ "[-W format] " CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_choose_tree_exec }; @@ -49,7 +48,6 @@ const struct cmd_entry cmd_choose_session_entry = { "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE " [-F format] [template]", 0, - NULL, cmd_choose_tree_exec }; @@ -58,7 +56,6 @@ const struct cmd_entry cmd_choose_window_entry = { "F:t:", 0, 1, CMD_TARGET_WINDOW_USAGE "[-F format] [template]", 0, - NULL, cmd_choose_tree_exec }; diff --git a/usr.bin/tmux/cmd-clear-history.c b/usr.bin/tmux/cmd-clear-history.c index 134505c69b9..40916533d26 100644 --- a/usr.bin/tmux/cmd-clear-history.c +++ b/usr.bin/tmux/cmd-clear-history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-clear-history.c,v 1.11 2013/10/10 12:00:18 nicm Exp $ */ +/* $OpenBSD: cmd-clear-history.c,v 1.12 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_clear_history_entry = { "t:", 0, 0, CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_clear_history_exec }; diff --git a/usr.bin/tmux/cmd-clock-mode.c b/usr.bin/tmux/cmd-clock-mode.c index beddbe639c0..a852fbc05b7 100644 --- a/usr.bin/tmux/cmd-clock-mode.c +++ b/usr.bin/tmux/cmd-clock-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-clock-mode.c,v 1.9 2013/10/10 12:00:18 nicm Exp $ */ +/* $OpenBSD: cmd-clock-mode.c,v 1.10 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_clock_mode_entry = { "t:", 0, 0, CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_clock_mode_exec }; diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c index 046796da14b..d7fcf3c31c8 100644 --- a/usr.bin/tmux/cmd-command-prompt.c +++ b/usr.bin/tmux/cmd-command-prompt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-command-prompt.c,v 1.27 2013/10/10 12:00:19 nicm Exp $ */ +/* $OpenBSD: cmd-command-prompt.c,v 1.28 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -29,7 +29,6 @@ * Prompt for command in client. */ -void cmd_command_prompt_key_binding(struct cmd *, int); enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); int cmd_command_prompt_callback(void *, const char *); @@ -40,7 +39,6 @@ const struct cmd_entry cmd_command_prompt_entry = { "I:p:t:", 0, 1, "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]", 0, - cmd_command_prompt_key_binding, cmd_command_prompt_exec }; @@ -54,34 +52,6 @@ struct cmd_command_prompt_cdata { int idx; }; -void -cmd_command_prompt_key_binding(struct cmd *self, int key) -{ - switch (key) { - case '$': - self->args = args_create(1, "rename-session '%%'"); - args_set(self->args, 'I', "#S"); - break; - case ',': - self->args = args_create(1, "rename-window '%%'"); - args_set(self->args, 'I', "#W"); - break; - case '.': - self->args = args_create(1, "move-window -t '%%'"); - break; - case 'f': - self->args = args_create(1, "find-window '%%'"); - break; - case '\'': - self->args = args_create(1, "select-window -t ':%%'"); - args_set(self->args, 'p', "index"); - break; - default: - self->args = args_create(0); - break; - } -} - enum cmd_retval cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c index dbcb555f668..8116b3dd712 100644 --- a/usr.bin/tmux/cmd-confirm-before.c +++ b/usr.bin/tmux/cmd-confirm-before.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-confirm-before.c,v 1.20 2013/10/10 12:00:19 nicm Exp $ */ +/* $OpenBSD: cmd-confirm-before.c,v 1.21 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -26,7 +26,6 @@ * Asks for confirmation before executing a command. */ -void cmd_confirm_before_key_binding(struct cmd *, int); enum cmd_retval cmd_confirm_before_exec(struct cmd *, struct cmd_q *); int cmd_confirm_before_callback(void *, const char *); @@ -37,7 +36,6 @@ const struct cmd_entry cmd_confirm_before_entry = { "p:t:", 1, 1, "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", 0, - cmd_confirm_before_key_binding, cmd_confirm_before_exec }; @@ -46,24 +44,6 @@ struct cmd_confirm_before_data { struct client *client; }; -void -cmd_confirm_before_key_binding(struct cmd *self, int key) -{ - switch (key) { - case '&': - self->args = args_create(1, "kill-window"); - args_set(self->args, 'p', "kill-window #W? (y/n)"); - break; - case 'x': - self->args = args_create(1, "kill-pane"); - args_set(self->args, 'p', "kill-pane #P? (y/n)"); - break; - default: - self->args = args_create(0); - break; - } -} - enum cmd_retval cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c index 63c9719f457..1b6cf3bf4b6 100644 --- a/usr.bin/tmux/cmd-copy-mode.c +++ b/usr.bin/tmux/cmd-copy-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-copy-mode.c,v 1.16 2013/10/10 12:00:19 nicm Exp $ */ +/* $OpenBSD: cmd-copy-mode.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,7 +24,6 @@ * Enter copy mode. */ -void cmd_copy_mode_key_binding(struct cmd *, int); enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_copy_mode_entry = { @@ -32,18 +31,9 @@ const struct cmd_entry cmd_copy_mode_entry = { "t:u", 0, 0, "[-u] " CMD_TARGET_PANE_USAGE, 0, - cmd_copy_mode_key_binding, cmd_copy_mode_exec }; -void -cmd_copy_mode_key_binding(struct cmd *self, int key) -{ - self->args = args_create(0); - if (key == KEYC_PPAGE) - args_set(self->args, 'u', NULL); -} - enum cmd_retval cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-delete-buffer.c b/usr.bin/tmux/cmd-delete-buffer.c index d60897ab7e2..e1b8dbc8dbb 100644 --- a/usr.bin/tmux/cmd-delete-buffer.c +++ b/usr.bin/tmux/cmd-delete-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-delete-buffer.c,v 1.12 2014/05/13 07:34:35 nicm Exp $ */ +/* $OpenBSD: cmd-delete-buffer.c,v 1.13 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_delete_buffer_entry = { "b:", 0, 0, CMD_BUFFER_USAGE, 0, - NULL, cmd_delete_buffer_exec }; diff --git a/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c index 110582a46b3..1009bd03860 100644 --- a/usr.bin/tmux/cmd-detach-client.c +++ b/usr.bin/tmux/cmd-detach-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-detach-client.c,v 1.16 2013/10/15 00:15:11 nicm Exp $ */ +/* $OpenBSD: cmd-detach-client.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_detach_client_entry = { "as:t:P", 0, 0, "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, CMD_READONLY, - NULL, cmd_detach_client_exec }; diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index 8f0432ca360..74dfb5be569 100644 --- a/usr.bin/tmux/cmd-display-message.c +++ b/usr.bin/tmux/cmd-display-message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-message.c,v 1.24 2013/10/10 12:01:14 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.25 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -35,7 +35,6 @@ const struct cmd_entry cmd_display_message_entry = { "[-p] [-c target-client] [-F format] " CMD_TARGET_PANE_USAGE " [message]", 0, - NULL, cmd_display_message_exec }; diff --git a/usr.bin/tmux/cmd-display-panes.c b/usr.bin/tmux/cmd-display-panes.c index f806b5d03cb..59ccab77b77 100644 --- a/usr.bin/tmux/cmd-display-panes.c +++ b/usr.bin/tmux/cmd-display-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-panes.c,v 1.7 2013/10/10 12:00:19 nicm Exp $ */ +/* $OpenBSD: cmd-display-panes.c,v 1.8 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_display_panes_entry = { "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, 0, - NULL, cmd_display_panes_exec }; diff --git a/usr.bin/tmux/cmd-find-window.c b/usr.bin/tmux/cmd-find-window.c index 0b03f9a6940..fd1cc182f60 100644 --- a/usr.bin/tmux/cmd-find-window.c +++ b/usr.bin/tmux/cmd-find-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-find-window.c,v 1.27 2014/05/08 06:06:07 nicm Exp $ */ +/* $OpenBSD: cmd-find-window.c,v 1.28 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -47,7 +47,6 @@ const struct cmd_entry cmd_find_window_entry = { "F:CNt:T", 1, 4, "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", 0, - NULL, cmd_find_window_exec }; diff --git a/usr.bin/tmux/cmd-has-session.c b/usr.bin/tmux/cmd-has-session.c index d3b9562169b..fbd6e95a150 100644 --- a/usr.bin/tmux/cmd-has-session.c +++ b/usr.bin/tmux/cmd-has-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-has-session.c,v 1.9 2013/10/10 12:00:19 nicm Exp $ */ +/* $OpenBSD: cmd-has-session.c,v 1.10 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_has_session_entry = { "t:", 0, 0, CMD_TARGET_SESSION_USAGE, 0, - NULL, cmd_has_session_exec }; diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index 6a29c2a6449..7a823586005 100644 --- a/usr.bin/tmux/cmd-if-shell.c +++ b/usr.bin/tmux/cmd-if-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.25 2013/10/10 12:04:38 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.26 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -40,7 +40,6 @@ const struct cmd_entry cmd_if_shell_entry = { "bt:", 2, 3, "[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]", 0, - NULL, cmd_if_shell_exec }; diff --git a/usr.bin/tmux/cmd-join-pane.c b/usr.bin/tmux/cmd-join-pane.c index d75ed6884e0..f8fa8a6cc4e 100644 --- a/usr.bin/tmux/cmd-join-pane.c +++ b/usr.bin/tmux/cmd-join-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-join-pane.c,v 1.16 2014/04/17 09:13:13 nicm Exp $ */ +/* $OpenBSD: cmd-join-pane.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2011 George Nachman <tmux@georgester.com> @@ -29,7 +29,6 @@ * Join or move a pane into another (like split/swap/kill). */ -void cmd_join_pane_key_binding(struct cmd *, int); enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_q *); enum cmd_retval join_pane(struct cmd *, struct cmd_q *, int); @@ -39,7 +38,6 @@ const struct cmd_entry cmd_join_pane_entry = { "bdhvp:l:s:t:", 0, 0, "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", 0, - cmd_join_pane_key_binding, cmd_join_pane_exec }; @@ -48,24 +46,9 @@ const struct cmd_entry cmd_move_pane_entry = { "bdhvp:l:s:t:", 0, 0, "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", 0, - NULL, cmd_join_pane_exec }; -void -cmd_join_pane_key_binding(struct cmd *self, int key) -{ - switch (key) { - case '%': - self->args = args_create(0); - args_set(self->args, 'h', NULL); - break; - default: - self->args = args_create(0); - break; - } -} - enum cmd_retval cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-kill-pane.c b/usr.bin/tmux/cmd-kill-pane.c index a53ac179000..951095afc71 100644 --- a/usr.bin/tmux/cmd-kill-pane.c +++ b/usr.bin/tmux/cmd-kill-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-pane.c,v 1.15 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-kill-pane.c,v 1.16 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_kill_pane_entry = { "at:", 0, 0, "[-a] " CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_kill_pane_exec }; diff --git a/usr.bin/tmux/cmd-kill-server.c b/usr.bin/tmux/cmd-kill-server.c index 31e179b88c7..993dde9d7ad 100644 --- a/usr.bin/tmux/cmd-kill-server.c +++ b/usr.bin/tmux/cmd-kill-server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-server.c,v 1.12 2014/01/27 23:57:35 nicm Exp $ */ +/* $OpenBSD: cmd-kill-server.c,v 1.13 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_kill_server_entry = { "", 0, 0, "", 0, - NULL, cmd_kill_server_exec }; @@ -43,7 +42,6 @@ const struct cmd_entry cmd_start_server_entry = { "", 0, 0, "", CMD_STARTSERVER, - NULL, cmd_kill_server_exec }; diff --git a/usr.bin/tmux/cmd-kill-session.c b/usr.bin/tmux/cmd-kill-session.c index 9f52eb3bd64..2471dd6b684 100644 --- a/usr.bin/tmux/cmd-kill-session.c +++ b/usr.bin/tmux/cmd-kill-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-session.c,v 1.13 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-kill-session.c,v 1.14 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_kill_session_entry = { "at:", 0, 0, "[-a] " CMD_TARGET_SESSION_USAGE, 0, - NULL, cmd_kill_session_exec }; diff --git a/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c index 35bf3fe0e44..ef51ca8692b 100644 --- a/usr.bin/tmux/cmd-kill-window.c +++ b/usr.bin/tmux/cmd-kill-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-window.c,v 1.14 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-kill-window.c,v 1.15 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_kill_window_entry = { "at:", 0, 0, "[-a] " CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_kill_window_exec }; diff --git a/usr.bin/tmux/cmd-link-window.c b/usr.bin/tmux/cmd-link-window.c index 087e7b52ff7..18a04e59c96 100644 --- a/usr.bin/tmux/cmd-link-window.c +++ b/usr.bin/tmux/cmd-link-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-link-window.c,v 1.14 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-link-window.c,v 1.15 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_link_window_entry = { "dks:t:", 0, 0, "[-dk] " CMD_SRCDST_WINDOW_USAGE, 0, - NULL, cmd_link_window_exec }; diff --git a/usr.bin/tmux/cmd-list-buffers.c b/usr.bin/tmux/cmd-list-buffers.c index a43e32b51ba..ce6438a7980 100644 --- a/usr.bin/tmux/cmd-list-buffers.c +++ b/usr.bin/tmux/cmd-list-buffers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-buffers.c,v 1.21 2014/05/13 07:34:35 nicm Exp $ */ +/* $OpenBSD: cmd-list-buffers.c,v 1.22 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_list_buffers_entry = { "F:", 0, 0, "[-F format]", 0, - NULL, cmd_list_buffers_exec }; diff --git a/usr.bin/tmux/cmd-list-clients.c b/usr.bin/tmux/cmd-list-clients.c index ef4993ae61e..3271b835fdb 100644 --- a/usr.bin/tmux/cmd-list-clients.c +++ b/usr.bin/tmux/cmd-list-clients.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-clients.c,v 1.17 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-list-clients.c,v 1.18 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_clients_entry = { "F:t:", 0, 0, "[-F format] " CMD_TARGET_SESSION_USAGE, CMD_READONLY, - NULL, cmd_list_clients_exec }; diff --git a/usr.bin/tmux/cmd-list-commands.c b/usr.bin/tmux/cmd-list-commands.c index 95375ccfa22..36eca45c84a 100644 --- a/usr.bin/tmux/cmd-list-commands.c +++ b/usr.bin/tmux/cmd-list-commands.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-commands.c,v 1.11 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-list-commands.c,v 1.12 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_list_commands_entry = { "", 0, 0, "", 0, - NULL, cmd_list_commands_exec }; diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index 5ab437c54a9..39f7dbdfeed 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.22 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.23 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_list_keys_entry = { "t:", 0, 0, "[-t key-table]", 0, - NULL, cmd_list_keys_exec }; diff --git a/usr.bin/tmux/cmd-list-panes.c b/usr.bin/tmux/cmd-list-panes.c index 419b5b776a8..5bab8c156b3 100644 --- a/usr.bin/tmux/cmd-list-panes.c +++ b/usr.bin/tmux/cmd-list-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-panes.c,v 1.18 2013/10/10 12:00:20 nicm Exp $ */ +/* $OpenBSD: cmd-list-panes.c,v 1.19 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -40,7 +40,6 @@ const struct cmd_entry cmd_list_panes_entry = { "asF:t:", 0, 0, "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_list_panes_exec }; diff --git a/usr.bin/tmux/cmd-list-sessions.c b/usr.bin/tmux/cmd-list-sessions.c index 0c73c58a86d..30287bcb184 100644 --- a/usr.bin/tmux/cmd-list-sessions.c +++ b/usr.bin/tmux/cmd-list-sessions.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-sessions.c,v 1.16 2013/10/10 12:00:21 nicm Exp $ */ +/* $OpenBSD: cmd-list-sessions.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_sessions_entry = { "F:", 0, 0, "[-F format]", 0, - NULL, cmd_list_sessions_exec }; diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c index f38df5e08a7..111070d9bea 100644 --- a/usr.bin/tmux/cmd-list-windows.c +++ b/usr.bin/tmux/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-windows.c,v 1.27 2013/10/10 12:00:21 nicm Exp $ */ +/* $OpenBSD: cmd-list-windows.c,v 1.28 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -38,7 +38,6 @@ const struct cmd_entry cmd_list_windows_entry = { "F:at:", 0, 0, "[-a] [-F format] " CMD_TARGET_SESSION_USAGE, 0, - NULL, cmd_list_windows_exec }; diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c index 107c1e32cdc..dcae4e97916 100644 --- a/usr.bin/tmux/cmd-load-buffer.c +++ b/usr.bin/tmux/cmd-load-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-load-buffer.c,v 1.30 2014/09/01 21:50:18 nicm Exp $ */ +/* $OpenBSD: cmd-load-buffer.c,v 1.31 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -39,7 +39,6 @@ const struct cmd_entry cmd_load_buffer_entry = { "b:", 1, 1, CMD_BUFFER_USAGE " path", 0, - NULL, cmd_load_buffer_exec }; diff --git a/usr.bin/tmux/cmd-lock-server.c b/usr.bin/tmux/cmd-lock-server.c index 55c2ffd6aff..a26bf012cf2 100644 --- a/usr.bin/tmux/cmd-lock-server.c +++ b/usr.bin/tmux/cmd-lock-server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-lock-server.c,v 1.16 2014/04/17 11:38:35 nicm Exp $ */ +/* $OpenBSD: cmd-lock-server.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_lock_server_entry = { "", 0, 0, "", 0, - NULL, cmd_lock_server_exec }; @@ -40,7 +39,6 @@ const struct cmd_entry cmd_lock_session_entry = { "t:", 0, 0, CMD_TARGET_SESSION_USAGE, 0, - NULL, cmd_lock_server_exec }; @@ -49,7 +47,6 @@ const struct cmd_entry cmd_lock_client_entry = { "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, 0, - NULL, cmd_lock_server_exec }; diff --git a/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c index 8c7edeb6be8..02f88bdc5d1 100644 --- a/usr.bin/tmux/cmd-move-window.c +++ b/usr.bin/tmux/cmd-move-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-move-window.c,v 1.16 2013/10/10 12:00:21 nicm Exp $ */ +/* $OpenBSD: cmd-move-window.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_move_window_entry = { "dkrs:t:", 0, 0, "[-dkr] " CMD_SRCDST_WINDOW_USAGE, 0, - NULL, cmd_move_window_exec }; diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 60d89f29e52..092b5a784ba 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.60 2014/05/13 08:08:32 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.61 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -40,7 +40,6 @@ const struct cmd_entry cmd_new_session_entry = { "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " "[-y height] [command]", CMD_STARTSERVER|CMD_CANTNEST, - NULL, cmd_new_session_exec }; diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c index c6501e3f386..22c7c6acd85 100644 --- a/usr.bin/tmux/cmd-new-window.c +++ b/usr.bin/tmux/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-window.c,v 1.41 2014/09/01 21:50:18 nicm Exp $ */ +/* $OpenBSD: cmd-new-window.c,v 1.42 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -38,7 +38,6 @@ const struct cmd_entry cmd_new_window_entry = { "[-adkP] [-c start-directory] [-F format] [-n window-name] " CMD_TARGET_WINDOW_USAGE " [command]", 0, - NULL, cmd_new_window_exec }; diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c index 088c9498441..6e3cfff1c2a 100644 --- a/usr.bin/tmux/cmd-paste-buffer.c +++ b/usr.bin/tmux/cmd-paste-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-paste-buffer.c,v 1.25 2014/05/13 07:34:35 nicm Exp $ */ +/* $OpenBSD: cmd-paste-buffer.c,v 1.26 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -38,7 +38,6 @@ const struct cmd_entry cmd_paste_buffer_entry = { "db:prs:t:", 0, 0, "[-dpr] [-s separator] " CMD_BUFFER_USAGE " " CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_paste_buffer_exec }; diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c index c525888ca96..8e22f25f5a1 100644 --- a/usr.bin/tmux/cmd-pipe-pane.c +++ b/usr.bin/tmux/cmd-pipe-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-pipe-pane.c,v 1.26 2013/10/10 12:00:21 nicm Exp $ */ +/* $OpenBSD: cmd-pipe-pane.c,v 1.27 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -41,7 +41,6 @@ const struct cmd_entry cmd_pipe_pane_entry = { "ot:", 0, 1, "[-o] " CMD_TARGET_PANE_USAGE " [command]", 0, - NULL, cmd_pipe_pane_exec }; diff --git a/usr.bin/tmux/cmd-refresh-client.c b/usr.bin/tmux/cmd-refresh-client.c index 9fabde9779b..f4e85ca9f5b 100644 --- a/usr.bin/tmux/cmd-refresh-client.c +++ b/usr.bin/tmux/cmd-refresh-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-refresh-client.c,v 1.12 2013/10/10 12:00:21 nicm Exp $ */ +/* $OpenBSD: cmd-refresh-client.c,v 1.13 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_refresh_client_entry = { "C:St:", 0, 0, "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, 0, - NULL, cmd_refresh_client_exec }; diff --git a/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c index c7551d28124..5246ab0ac37 100644 --- a/usr.bin/tmux/cmd-rename-session.c +++ b/usr.bin/tmux/cmd-rename-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rename-session.c,v 1.15 2013/10/10 12:00:21 nicm Exp $ */ +/* $OpenBSD: cmd-rename-session.c,v 1.16 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_rename_session_entry = { "t:", 1, 1, CMD_TARGET_SESSION_USAGE " new-name", 0, - NULL, cmd_rename_session_exec }; diff --git a/usr.bin/tmux/cmd-rename-window.c b/usr.bin/tmux/cmd-rename-window.c index 009e3ad7bdd..ebc70502404 100644 --- a/usr.bin/tmux/cmd-rename-window.c +++ b/usr.bin/tmux/cmd-rename-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rename-window.c,v 1.10 2013/10/10 12:00:22 nicm Exp $ */ +/* $OpenBSD: cmd-rename-window.c,v 1.11 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_rename_window_entry = { "t:", 1, 1, CMD_TARGET_WINDOW_USAGE " new-name", 0, - NULL, cmd_rename_window_exec }; diff --git a/usr.bin/tmux/cmd-resize-pane.c b/usr.bin/tmux/cmd-resize-pane.c index c229fad9bbb..2335ae691a9 100644 --- a/usr.bin/tmux/cmd-resize-pane.c +++ b/usr.bin/tmux/cmd-resize-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-resize-pane.c,v 1.16 2013/10/10 12:00:22 nicm Exp $ */ +/* $OpenBSD: cmd-resize-pane.c,v 1.17 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,7 +26,6 @@ * Increase or decrease pane size. */ -void cmd_resize_pane_key_binding(struct cmd *, int); enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_resize_pane_entry = { @@ -34,56 +33,9 @@ const struct cmd_entry cmd_resize_pane_entry = { "DLRt:Ux:y:Z", 0, 1, "[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", 0, - cmd_resize_pane_key_binding, cmd_resize_pane_exec }; -void -cmd_resize_pane_key_binding(struct cmd *self, int key) -{ - switch (key) { - case KEYC_UP | KEYC_CTRL: - self->args = args_create(0); - args_set(self->args, 'U', NULL); - break; - case KEYC_DOWN | KEYC_CTRL: - self->args = args_create(0); - args_set(self->args, 'D', NULL); - break; - case KEYC_LEFT | KEYC_CTRL: - self->args = args_create(0); - args_set(self->args, 'L', NULL); - break; - case KEYC_RIGHT | KEYC_CTRL: - self->args = args_create(0); - args_set(self->args, 'R', NULL); - break; - case KEYC_UP | KEYC_ESCAPE: - self->args = args_create(1, "5"); - args_set(self->args, 'U', NULL); - break; - case KEYC_DOWN | KEYC_ESCAPE: - self->args = args_create(1, "5"); - args_set(self->args, 'D', NULL); - break; - case KEYC_LEFT | KEYC_ESCAPE: - self->args = args_create(1, "5"); - args_set(self->args, 'L', NULL); - break; - case KEYC_RIGHT | KEYC_ESCAPE: - self->args = args_create(1, "5"); - args_set(self->args, 'R', NULL); - break; - case 'z': - self->args = args_create(0); - args_set(self->args, 'Z', NULL); - break; - default: - self->args = args_create(0); - break; - } -} - enum cmd_retval cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-respawn-window.c b/usr.bin/tmux/cmd-respawn-window.c index 8d7d350796d..6da58be5237 100644 --- a/usr.bin/tmux/cmd-respawn-window.c +++ b/usr.bin/tmux/cmd-respawn-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-respawn-window.c,v 1.22 2014/05/13 08:08:32 nicm Exp $ */ +/* $OpenBSD: cmd-respawn-window.c,v 1.23 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_respawn_window_entry = { "kt:", 0, -1, "[-k] " CMD_TARGET_WINDOW_USAGE " [command]", 0, - NULL, cmd_respawn_window_exec }; diff --git a/usr.bin/tmux/cmd-rotate-window.c b/usr.bin/tmux/cmd-rotate-window.c index 9144f5d7277..461bf42ad44 100644 --- a/usr.bin/tmux/cmd-rotate-window.c +++ b/usr.bin/tmux/cmd-rotate-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rotate-window.c,v 1.14 2013/10/10 12:00:22 nicm Exp $ */ +/* $OpenBSD: cmd-rotate-window.c,v 1.15 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,7 +24,6 @@ * Rotate the panes in a window. */ -void cmd_rotate_window_key_binding(struct cmd *, int); enum cmd_retval cmd_rotate_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rotate_window_entry = { @@ -32,18 +31,9 @@ const struct cmd_entry cmd_rotate_window_entry = { "Dt:U", 0, 0, "[-DU] " CMD_TARGET_WINDOW_USAGE, 0, - cmd_rotate_window_key_binding, cmd_rotate_window_exec }; -void -cmd_rotate_window_key_binding(struct cmd *self, int key) -{ - self->args = args_create(0); - if (key == ('o' | KEYC_ESCAPE)) - args_set(self->args, 'D', NULL); -} - enum cmd_retval cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 2a291e60294..ac91d1c6d78 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.25 2014/04/17 07:55:43 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.26 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -40,7 +40,6 @@ const struct cmd_entry cmd_run_shell_entry = { "bt:", 1, 1, "[-b] " CMD_TARGET_PANE_USAGE " shell-command", 0, - NULL, cmd_run_shell_exec }; diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c index de83b5c0f09..d5700e2fb13 100644 --- a/usr.bin/tmux/cmd-save-buffer.c +++ b/usr.bin/tmux/cmd-save-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-save-buffer.c,v 1.26 2014/10/08 17:35:58 nicm Exp $ */ +/* $OpenBSD: cmd-save-buffer.c,v 1.27 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -39,7 +39,6 @@ const struct cmd_entry cmd_save_buffer_entry = { "ab:", 1, 1, "[-a] " CMD_BUFFER_USAGE " path", 0, - NULL, cmd_save_buffer_exec }; @@ -48,7 +47,6 @@ const struct cmd_entry cmd_show_buffer_entry = { "b:", 0, 0, CMD_BUFFER_USAGE, 0, - NULL, cmd_save_buffer_exec }; diff --git a/usr.bin/tmux/cmd-select-layout.c b/usr.bin/tmux/cmd-select-layout.c index 19eb0882e4b..0caa07a7ed0 100644 --- a/usr.bin/tmux/cmd-select-layout.c +++ b/usr.bin/tmux/cmd-select-layout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-layout.c,v 1.22 2014/04/17 07:55:43 nicm Exp $ */ +/* $OpenBSD: cmd-select-layout.c,v 1.23 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,15 +24,12 @@ * Switch window to selected layout. */ -void cmd_select_layout_key_binding(struct cmd *, int); enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_layout_entry = { "select-layout", "selectl", "npt:", 0, 1, "[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]", - 0, - cmd_select_layout_key_binding, cmd_select_layout_exec }; @@ -41,7 +38,6 @@ const struct cmd_entry cmd_next_layout_entry = { "t:", 0, 0, CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_select_layout_exec }; @@ -50,35 +46,9 @@ const struct cmd_entry cmd_previous_layout_entry = { "t:", 0, 0, CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_select_layout_exec }; -void -cmd_select_layout_key_binding(struct cmd *self, int key) -{ - switch (key) { - case '1' | KEYC_ESCAPE: - self->args = args_create(1, "even-horizontal"); - break; - case '2' | KEYC_ESCAPE: - self->args = args_create(1, "even-vertical"); - break; - case '3' | KEYC_ESCAPE: - self->args = args_create(1, "main-horizontal"); - break; - case '4' | KEYC_ESCAPE: - self->args = args_create(1, "main-vertical"); - break; - case '5' | KEYC_ESCAPE: - self->args = args_create(1, "tiled"); - break; - default: - self->args = args_create(0); - break; - } -} - enum cmd_retval cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index 3d1b2d54616..ab796a8dbff 100644 --- a/usr.bin/tmux/cmd-select-pane.c +++ b/usr.bin/tmux/cmd-select-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-pane.c,v 1.18 2014/08/11 22:14:30 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.19 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,7 +24,6 @@ * Select pane. */ -void cmd_select_pane_key_binding(struct cmd *, int); enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_pane_entry = { @@ -32,7 +31,6 @@ const struct cmd_entry cmd_select_pane_entry = { "DdeLlRt:U", 0, 0, "[-DdeLlRU] " CMD_TARGET_PANE_USAGE, 0, - cmd_select_pane_key_binding, cmd_select_pane_exec }; @@ -41,26 +39,9 @@ const struct cmd_entry cmd_last_pane_entry = { "det:", 0, 0, "[-de] " CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_select_pane_exec }; -void -cmd_select_pane_key_binding(struct cmd *self, int key) -{ - self->args = args_create(0); - if (key == KEYC_UP) - args_set(self->args, 'U', NULL); - if (key == KEYC_DOWN) - args_set(self->args, 'D', NULL); - if (key == KEYC_LEFT) - args_set(self->args, 'L', NULL); - if (key == KEYC_RIGHT) - args_set(self->args, 'R', NULL); - if (key == 'o') - args_set(self->args, 't', ":.+"); -} - enum cmd_retval cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c index 551992f7cc2..c959bb37b66 100644 --- a/usr.bin/tmux/cmd-select-window.c +++ b/usr.bin/tmux/cmd-select-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-window.c,v 1.11 2013/10/10 12:00:22 nicm Exp $ */ +/* $OpenBSD: cmd-select-window.c,v 1.12 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,7 +26,6 @@ * Select window by index. */ -void cmd_select_window_key_binding(struct cmd *, int); enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_window_entry = { @@ -34,7 +33,6 @@ const struct cmd_entry cmd_select_window_entry = { "lnpTt:", 0, 0, "[-lnpT] " CMD_TARGET_WINDOW_USAGE, 0, - cmd_select_window_key_binding, cmd_select_window_exec }; @@ -43,7 +41,6 @@ const struct cmd_entry cmd_next_window_entry = { "at:", 0, 0, "[-a] " CMD_TARGET_SESSION_USAGE, 0, - cmd_select_window_key_binding, cmd_select_window_exec }; @@ -52,7 +49,6 @@ const struct cmd_entry cmd_previous_window_entry = { "at:", 0, 0, "[-a] " CMD_TARGET_SESSION_USAGE, 0, - cmd_select_window_key_binding, cmd_select_window_exec }; @@ -61,24 +57,9 @@ const struct cmd_entry cmd_last_window_entry = { "t:", 0, 0, CMD_TARGET_SESSION_USAGE, 0, - NULL, cmd_select_window_exec }; -void -cmd_select_window_key_binding(struct cmd *self, int key) -{ - char tmp[16]; - - self->args = args_create(0); - if (key >= '0' && key <= '9') { - xsnprintf(tmp, sizeof tmp, ":%d", key - '0'); - args_set(self->args, 't', tmp); - } - if (key == ('n' | KEYC_ESCAPE) || key == ('p' | KEYC_ESCAPE)) - args_set(self->args, 'a', NULL); -} - enum cmd_retval cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index bbe0fa31578..e35f57f9022 100644 --- a/usr.bin/tmux/cmd-send-keys.c +++ b/usr.bin/tmux/cmd-send-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-send-keys.c,v 1.17 2013/10/10 12:00:23 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.18 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_send_keys_entry = { "lRt:", 0, -1, "[-lR] " CMD_TARGET_PANE_USAGE " key ...", 0, - NULL, cmd_send_keys_exec }; @@ -43,7 +42,6 @@ const struct cmd_entry cmd_send_prefix_entry = { "2t:", 0, 0, "[-2] " CMD_TARGET_PANE_USAGE, 0, - NULL, cmd_send_keys_exec }; diff --git a/usr.bin/tmux/cmd-set-buffer.c b/usr.bin/tmux/cmd-set-buffer.c index 0f5d4e995b6..9c825042034 100644 --- a/usr.bin/tmux/cmd-set-buffer.c +++ b/usr.bin/tmux/cmd-set-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-buffer.c,v 1.19 2014/10/08 17:35:58 nicm Exp $ */ +/* $OpenBSD: cmd-set-buffer.c,v 1.20 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_set_buffer_entry = { "ab:n:", 0, 1, "[-a] " CMD_BUFFER_USAGE " [-n new-buffer-name] data", 0, - NULL, cmd_set_buffer_exec }; diff --git a/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c index 8833ea8ab57..e5459de9efc 100644 --- a/usr.bin/tmux/cmd-set-environment.c +++ b/usr.bin/tmux/cmd-set-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-environment.c,v 1.9 2013/10/10 12:00:23 nicm Exp $ */ +/* $OpenBSD: cmd-set-environment.c,v 1.10 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_set_environment_entry = { "grt:u", 1, 2, "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", 0, - NULL, cmd_set_environment_exec }; diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index 796abb67587..6c48a310508 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.70 2014/09/01 21:50:18 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.71 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -69,7 +69,6 @@ const struct cmd_entry cmd_set_option_entry = { "agoqst:uw", 1, 2, "[-agosquw] [-t target-session|target-window] option [value]", 0, - NULL, cmd_set_option_exec }; @@ -78,7 +77,6 @@ const struct cmd_entry cmd_set_window_option_entry = { "agoqt:u", 1, 2, "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", 0, - NULL, cmd_set_option_exec }; diff --git a/usr.bin/tmux/cmd-show-environment.c b/usr.bin/tmux/cmd-show-environment.c index 8aee6a633a6..6b0b1ff4ea5 100644 --- a/usr.bin/tmux/cmd-show-environment.c +++ b/usr.bin/tmux/cmd-show-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-environment.c,v 1.8 2013/10/10 12:00:23 nicm Exp $ */ +/* $OpenBSD: cmd-show-environment.c,v 1.9 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_show_environment_entry = { "gt:", 0, 1, "[-g] " CMD_TARGET_SESSION_USAGE " [name]", 0, - NULL, cmd_show_environment_exec }; diff --git a/usr.bin/tmux/cmd-show-messages.c b/usr.bin/tmux/cmd-show-messages.c index 3f8d8918f45..2ce8f8a1753 100644 --- a/usr.bin/tmux/cmd-show-messages.c +++ b/usr.bin/tmux/cmd-show-messages.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-messages.c,v 1.9 2014/02/14 13:59:01 nicm Exp $ */ +/* $OpenBSD: cmd-show-messages.c,v 1.10 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_show_messages_entry = { "IJTt:", 0, 0, "[-IJT] " CMD_TARGET_CLIENT_USAGE, 0, - NULL, cmd_show_messages_exec }; @@ -45,7 +44,6 @@ const struct cmd_entry cmd_server_info_entry = { "", 0, 0, "", 0, - NULL, cmd_show_messages_exec }; diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c index 100c85dd8c1..9d73acba89a 100644 --- a/usr.bin/tmux/cmd-show-options.c +++ b/usr.bin/tmux/cmd-show-options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-options.c,v 1.22 2014/04/17 07:43:20 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.23 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -39,7 +39,6 @@ const struct cmd_entry cmd_show_options_entry = { "gqst:vw", 0, 1, "[-gqsvw] [-t target-session|target-window] [option]", 0, - NULL, cmd_show_options_exec }; @@ -48,7 +47,6 @@ const struct cmd_entry cmd_show_window_options_entry = { "gvt:", 0, 1, "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", 0, - NULL, cmd_show_options_exec }; diff --git a/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c index 04c27c2a28f..e36f63545e6 100644 --- a/usr.bin/tmux/cmd-source-file.c +++ b/usr.bin/tmux/cmd-source-file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-source-file.c,v 1.19 2013/10/10 12:04:38 nicm Exp $ */ +/* $OpenBSD: cmd-source-file.c,v 1.20 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_source_file_entry = { "", 1, 1, "path", 0, - NULL, cmd_source_file_exec }; diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c index d46a38dd6a3..bd7ae3e52f5 100644 --- a/usr.bin/tmux/cmd-split-window.c +++ b/usr.bin/tmux/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-split-window.c,v 1.51 2014/09/01 21:50:18 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.52 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ * Split a window (add a new pane). */ -void cmd_split_window_key_binding(struct cmd *, int); enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_split_window_entry = { @@ -40,18 +39,9 @@ const struct cmd_entry cmd_split_window_entry = { "[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]", 0, - cmd_split_window_key_binding, cmd_split_window_exec }; -void -cmd_split_window_key_binding(struct cmd *self, int key) -{ - self->args = args_create(0); - if (key == '%') - args_set(self->args, 'h', NULL); -} - enum cmd_retval cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-suspend-client.c b/usr.bin/tmux/cmd-suspend-client.c index 4307fad6323..c9d76434e79 100644 --- a/usr.bin/tmux/cmd-suspend-client.c +++ b/usr.bin/tmux/cmd-suspend-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-suspend-client.c,v 1.10 2013/10/10 12:00:24 nicm Exp $ */ +/* $OpenBSD: cmd-suspend-client.c,v 1.11 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_suspend_client_entry = { "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, 0, - NULL, cmd_suspend_client_exec }; diff --git a/usr.bin/tmux/cmd-swap-pane.c b/usr.bin/tmux/cmd-swap-pane.c index 6d2f6664e0d..59554c1087c 100644 --- a/usr.bin/tmux/cmd-swap-pane.c +++ b/usr.bin/tmux/cmd-swap-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-swap-pane.c,v 1.18 2013/10/10 12:00:24 nicm Exp $ */ +/* $OpenBSD: cmd-swap-pane.c,v 1.19 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,7 +26,6 @@ * Swap two panes. */ -void cmd_swap_pane_key_binding(struct cmd *, int); enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_swap_pane_entry = { @@ -34,20 +33,9 @@ const struct cmd_entry cmd_swap_pane_entry = { "dDs:t:U", 0, 0, "[-dDU] " CMD_SRCDST_PANE_USAGE, 0, - cmd_swap_pane_key_binding, cmd_swap_pane_exec }; -void -cmd_swap_pane_key_binding(struct cmd *self, int key) -{ - self->args = args_create(0); - if (key == '{') - args_set(self->args, 'U', NULL); - else if (key == '}') - args_set(self->args, 'D', NULL); -} - enum cmd_retval cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-swap-window.c b/usr.bin/tmux/cmd-swap-window.c index b6712a3933c..a8cd845fc7f 100644 --- a/usr.bin/tmux/cmd-swap-window.c +++ b/usr.bin/tmux/cmd-swap-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-swap-window.c,v 1.10 2013/10/10 12:00:24 nicm Exp $ */ +/* $OpenBSD: cmd-swap-window.c,v 1.11 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -33,7 +33,6 @@ const struct cmd_entry cmd_swap_window_entry = { "ds:t:", 0, 0, "[-d] " CMD_SRCDST_WINDOW_USAGE, 0, - NULL, cmd_swap_window_exec }; diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index a32c64e892f..8b7b5bee7aa 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.21 2014/04/17 07:55:43 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.22 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -27,7 +27,6 @@ * Switch client to a different session. */ -void cmd_switch_client_key_binding(struct cmd *, int); enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_switch_client_entry = { @@ -35,27 +34,9 @@ const struct cmd_entry cmd_switch_client_entry = { "lc:npt:r", 0, 0, "[-lnpr] [-c target-client] [-t target-session]", CMD_READONLY, - cmd_switch_client_key_binding, cmd_switch_client_exec }; -void -cmd_switch_client_key_binding(struct cmd *self, int key) -{ - self->args = args_create(0); - switch (key) { - case '(': - args_set(self->args, 'p', NULL); - break; - case ')': - args_set(self->args, 'n', NULL); - break; - case 'L': - args_set(self->args, 'l', NULL); - break; - } -} - enum cmd_retval cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-unbind-key.c b/usr.bin/tmux/cmd-unbind-key.c index e1003c0ca3b..42988448ebc 100644 --- a/usr.bin/tmux/cmd-unbind-key.c +++ b/usr.bin/tmux/cmd-unbind-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-unbind-key.c,v 1.19 2014/05/14 06:45:35 nicm Exp $ */ +/* $OpenBSD: cmd-unbind-key.c,v 1.20 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,7 +34,6 @@ const struct cmd_entry cmd_unbind_key_entry = { "acnt:", 0, 1, "[-acn] [-t mode-table] key", 0, - NULL, cmd_unbind_key_exec }; diff --git a/usr.bin/tmux/cmd-unlink-window.c b/usr.bin/tmux/cmd-unlink-window.c index d98dbaa8213..62016db3f6a 100644 --- a/usr.bin/tmux/cmd-unlink-window.c +++ b/usr.bin/tmux/cmd-unlink-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-unlink-window.c,v 1.13 2013/10/10 12:00:24 nicm Exp $ */ +/* $OpenBSD: cmd-unlink-window.c,v 1.14 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -31,7 +31,6 @@ const struct cmd_entry cmd_unlink_window_entry = { "kt:", 0, 0, "[-k] " CMD_TARGET_WINDOW_USAGE, 0, - NULL, cmd_unlink_window_exec }; diff --git a/usr.bin/tmux/cmd-wait-for.c b/usr.bin/tmux/cmd-wait-for.c index ea48a551670..8358b5cdbbe 100644 --- a/usr.bin/tmux/cmd-wait-for.c +++ b/usr.bin/tmux/cmd-wait-for.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-wait-for.c,v 1.6 2014/09/01 21:58:41 nicm Exp $ */ +/* $OpenBSD: cmd-wait-for.c,v 1.7 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net> @@ -35,7 +35,6 @@ const struct cmd_entry cmd_wait_for_entry = { "LSU", 1, 1, "[-L|-S|-U] channel", 0, - NULL, cmd_wait_for_exec }; diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index 3c861045717..23620e03166 100644 --- a/usr.bin/tmux/key-bindings.c +++ b/usr.bin/tmux/key-bindings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-bindings.c,v 1.41 2014/05/14 06:21:19 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.42 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -84,107 +84,99 @@ key_bindings_remove(int key) void key_bindings_init(void) { - static const struct { - int key; - int can_repeat; - const struct cmd_entry *entry; - } table[] = { - { ' ', 0, &cmd_next_layout_entry }, - { '!', 0, &cmd_break_pane_entry }, - { '"', 0, &cmd_split_window_entry }, - { '#', 0, &cmd_list_buffers_entry }, - { '$', 0, &cmd_command_prompt_entry }, - { '%', 0, &cmd_split_window_entry }, - { '&', 0, &cmd_confirm_before_entry }, - { '(', 0, &cmd_switch_client_entry }, - { ')', 0, &cmd_switch_client_entry }, - { ',', 0, &cmd_command_prompt_entry }, - { '-', 0, &cmd_delete_buffer_entry }, - { '.', 0, &cmd_command_prompt_entry }, - { '0', 0, &cmd_select_window_entry }, - { '1', 0, &cmd_select_window_entry }, - { '2', 0, &cmd_select_window_entry }, - { '3', 0, &cmd_select_window_entry }, - { '4', 0, &cmd_select_window_entry }, - { '5', 0, &cmd_select_window_entry }, - { '6', 0, &cmd_select_window_entry }, - { '7', 0, &cmd_select_window_entry }, - { '8', 0, &cmd_select_window_entry }, - { '9', 0, &cmd_select_window_entry }, - { ':', 0, &cmd_command_prompt_entry }, - { ';', 0, &cmd_last_pane_entry }, - { '=', 0, &cmd_choose_buffer_entry }, - { '?', 0, &cmd_list_keys_entry }, - { 'D', 0, &cmd_choose_client_entry }, - { 'L', 0, &cmd_switch_client_entry }, - { '[', 0, &cmd_copy_mode_entry }, - { '\'', 0, &cmd_command_prompt_entry }, - { '\002', /* C-b */ 0, &cmd_send_prefix_entry }, - { '\017', /* C-o */ 0, &cmd_rotate_window_entry }, - { '\032', /* C-z */ 0, &cmd_suspend_client_entry }, - { ']', 0, &cmd_paste_buffer_entry }, - { 'c', 0, &cmd_new_window_entry }, - { 'd', 0, &cmd_detach_client_entry }, - { 'f', 0, &cmd_command_prompt_entry }, - { 'i', 0, &cmd_display_message_entry }, - { 'l', 0, &cmd_last_window_entry }, - { 'n', 0, &cmd_next_window_entry }, - { 'o', 0, &cmd_select_pane_entry }, - { 'p', 0, &cmd_previous_window_entry }, - { 'q', 0, &cmd_display_panes_entry }, - { 'r', 0, &cmd_refresh_client_entry }, - { 's', 0, &cmd_choose_tree_entry }, - { 't', 0, &cmd_clock_mode_entry }, - { 'w', 0, &cmd_choose_window_entry }, - { 'x', 0, &cmd_confirm_before_entry }, - { 'z', 0, &cmd_resize_pane_entry }, - { '{', 0, &cmd_swap_pane_entry }, - { '}', 0, &cmd_swap_pane_entry }, - { '~', 0, &cmd_show_messages_entry }, - { '1' | KEYC_ESCAPE, 0, &cmd_select_layout_entry }, - { '2' | KEYC_ESCAPE, 0, &cmd_select_layout_entry }, - { '3' | KEYC_ESCAPE, 0, &cmd_select_layout_entry }, - { '4' | KEYC_ESCAPE, 0, &cmd_select_layout_entry }, - { '5' | KEYC_ESCAPE, 0, &cmd_select_layout_entry }, - { KEYC_PPAGE, 0, &cmd_copy_mode_entry }, - { 'n' | KEYC_ESCAPE, 0, &cmd_next_window_entry }, - { 'o' | KEYC_ESCAPE, 0, &cmd_rotate_window_entry }, - { 'p' | KEYC_ESCAPE, 0, &cmd_previous_window_entry }, - { KEYC_UP, 1, &cmd_select_pane_entry }, - { KEYC_DOWN, 1, &cmd_select_pane_entry }, - { KEYC_LEFT, 1, &cmd_select_pane_entry }, - { KEYC_RIGHT, 1, &cmd_select_pane_entry }, - { KEYC_UP | KEYC_ESCAPE, 1, &cmd_resize_pane_entry }, - { KEYC_DOWN | KEYC_ESCAPE, 1, &cmd_resize_pane_entry }, - { KEYC_LEFT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry }, - { KEYC_RIGHT | KEYC_ESCAPE, 1, &cmd_resize_pane_entry }, - { KEYC_UP | KEYC_CTRL, 1, &cmd_resize_pane_entry }, - { KEYC_DOWN | KEYC_CTRL, 1, &cmd_resize_pane_entry }, - { KEYC_LEFT | KEYC_CTRL, 1, &cmd_resize_pane_entry }, - { KEYC_RIGHT | KEYC_CTRL, 1, &cmd_resize_pane_entry }, + static const char* defaults[] = { + "bind C-b send-prefix", + "bind C-o rotate-window", + "bind C-z suspend-client", + "bind Space next-layout", + "bind ! break-pane", + "bind '\"' split-window", + "bind '#' list-buffers", + "bind '$' command-prompt -I'#S' \"rename-session '%%'\"", + "bind % split-window -h", + "bind & confirm-before -p\"kill-window #W? (y/n)\" kill-window", + "bind \"'\" command-prompt -pindex \"select-window -t ':%%'\"", + "bind ( switch-client -p", + "bind ) switch-client -n", + "bind , command-prompt -I'#W' \"rename-window '%%'\"", + "bind - delete-buffer", + "bind . command-prompt \"move-window -t '%%'\"", + "bind 0 select-window -t:0", + "bind 1 select-window -t:1", + "bind 2 select-window -t:2", + "bind 3 select-window -t:3", + "bind 4 select-window -t:4", + "bind 5 select-window -t:5", + "bind 6 select-window -t:6", + "bind 7 select-window -t:7", + "bind 8 select-window -t:8", + "bind 9 select-window -t:9", + "bind : command-prompt", + "bind \\; last-pane", + "bind = choose-buffer", + "bind ? list-keys", + "bind D choose-client", + "bind L switch-client -l", + "bind [ copy-mode", + "bind ] paste-buffer", + "bind c new-window", + "bind d detach-client", + "bind f command-prompt \"find-window '%%'\"", + "bind i display-message", + "bind l last-window", + "bind n next-window", + "bind o select-pane -t:.+", + "bind p previous-window", + "bind q display-panes", + "bind r refresh-client", + "bind s choose-tree", + "bind t clock-mode", + "bind w choose-window", + "bind x confirm-before -p\"kill-pane #P? (y/n)\" kill-pane", + "bind z resize-pane -Z", + "bind { swap-pane -U", + "bind } swap-pane -D", + "bind '~' show-messages", + "bind PPage copy-mode -u", + "bind -r Up select-pane -U", + "bind -r Down select-pane -D", + "bind -r Left select-pane -L", + "bind -r Right select-pane -R", + "bind M-1 select-layout even-horizontal", + "bind M-2 select-layout even-vertical", + "bind M-3 select-layout main-horizontal", + "bind M-4 select-layout main-vertical", + "bind M-5 select-layout tiled", + "bind M-n next-window -a", + "bind M-o rotate-window -D", + "bind M-p previous-window -a", + "bind -r M-Up resize-pane -U 5", + "bind -r M-Down resize-pane -D 5", + "bind -r M-Left resize-pane -L 5", + "bind -r M-Right resize-pane -R 5", + "bind -r C-Up resize-pane -U", + "bind -r C-Down resize-pane -D", + "bind -r C-Left resize-pane -L", + "bind -r C-Right resize-pane -R", }; u_int i; - struct cmd *cmd; struct cmd_list *cmdlist; + char* cause; + int error; + struct cmd_q *cmdq; RB_INIT(&key_bindings); - for (i = 0; i < nitems(table); i++) { - cmdlist = xcalloc(1, sizeof *cmdlist); - cmdlist->references = 1; - TAILQ_INIT(&cmdlist->list); - - cmd = xcalloc(1, sizeof *cmd); - cmd->entry = table[i].entry; - if (cmd->entry->key_binding != NULL) - cmd->entry->key_binding(cmd, table[i].key); - else - cmd->args = args_create(0); - TAILQ_INSERT_HEAD(&cmdlist->list, cmd, qentry); - - key_bindings_add( - table[i].key | KEYC_PREFIX, table[i].can_repeat, cmdlist); + cmdq = cmdq_new (NULL); + for (i = 0; i < nitems(defaults); i++) { + error = cmd_string_parse(defaults[i], &cmdlist, + "<default-keys>", i, &cause); + if (error != 0) + fatalx("bad default key"); + cmdq_run (cmdq, cmdlist); + cmd_list_free (cmdlist); } + cmdq_free (cmdq); } void diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index c433e6cc104..c5ed4adc14e 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.472 2014/10/08 17:35:58 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.473 2014/10/20 22:29:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1492,7 +1492,6 @@ struct cmd_entry { #define CMD_READONLY 0x4 int flags; - void (*key_binding)(struct cmd *, int); enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); }; |