diff options
author | 2009-07-24 14:52:47 +0000 | |
---|---|---|
committer | 2009-07-24 14:52:47 +0000 | |
commit | ad4696b537fd88242e90e5414f9cde4552fab706 (patch) | |
tree | 407eedf23c7119d1f557a9ba9fa4a5617e3e44d5 /usr.bin/tmux/cmd-bind-key.c | |
parent | up-pane and down-pane no longer auto-repeat; update the description of (diff) | |
download | wireguard-openbsd-ad4696b537fd88242e90e5414f9cde4552fab706.tar.xz wireguard-openbsd-ad4696b537fd88242e90e5414f9cde4552fab706.zip |
Permit commands to be bound to key presses without the prefix key first. The
new -n flag to bind-key and unbind-key sets or removes these bindings, and
list-key shows them in []s.
Diffstat (limited to 'usr.bin/tmux/cmd-bind-key.c')
-rw-r--r-- | usr.bin/tmux/cmd-bind-key.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-bind-key.c b/usr.bin/tmux/cmd-bind-key.c index 9f1220b6003..c4775474dc4 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.2 2009/07/13 23:11:35 nicm Exp $ */ +/* $OpenBSD: cmd-bind-key.c,v 1.3 2009/07/24 14:52:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -39,7 +39,7 @@ struct cmd_bind_key_data { const struct cmd_entry cmd_bind_key_entry = { "bind-key", "bind", - "[-r] key command [arguments]", + "[-nr] key command [arguments]", 0, 0, NULL, cmd_bind_key_parse, @@ -54,14 +54,17 @@ int cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause) { struct cmd_bind_key_data *data; - int opt; + int opt, no_prefix = 0; self->data = data = xmalloc(sizeof *data); data->can_repeat = 0; data->cmdlist = NULL; - while ((opt = getopt(argc, argv, "r")) != -1) { + while ((opt = getopt(argc, argv, "nr")) != -1) { switch (opt) { + case 'n': + no_prefix = 1; + break; case 'r': data->can_repeat = 1; break; @@ -78,6 +81,8 @@ cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause) xasprintf(cause, "unknown key: %s", argv[0]); goto error; } + if (!no_prefix) + data->key |= KEYC_PREFIX; argc--; argv++; |