summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-unbind-key.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-07-24 14:52:47 +0000
committernicm <nicm@openbsd.org>2009-07-24 14:52:47 +0000
commitad4696b537fd88242e90e5414f9cde4552fab706 (patch)
tree407eedf23c7119d1f557a9ba9fa4a5617e3e44d5 /usr.bin/tmux/cmd-unbind-key.c
parentup-pane and down-pane no longer auto-repeat; update the description of (diff)
downloadwireguard-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-unbind-key.c')
-rw-r--r--usr.bin/tmux/cmd-unbind-key.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-unbind-key.c b/usr.bin/tmux/cmd-unbind-key.c
index 94c0e8d2585..5415c601833 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.2 2009/07/13 23:11:35 nicm Exp $ */
+/* $OpenBSD: cmd-unbind-key.c,v 1.3 2009/07/24 14:52:47 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -36,7 +36,7 @@ struct cmd_unbind_key_data {
const struct cmd_entry cmd_unbind_key_entry = {
"unbind-key", "unbind",
- "key",
+ "[-n] key",
0, 0,
NULL,
cmd_unbind_key_parse,
@@ -51,12 +51,15 @@ int
cmd_unbind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
{
struct cmd_unbind_key_data *data;
- int opt;
+ int opt, no_prefix = 0;
self->data = data = xmalloc(sizeof *data);
- while ((opt = getopt(argc, argv, "")) != -1) {
+ while ((opt = getopt(argc, argv, "n")) != -1) {
switch (opt) {
+ case 'n':
+ no_prefix = 1;
+ break;
default:
goto usage;
}
@@ -70,6 +73,8 @@ cmd_unbind_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;
return (0);