Aloni.
-/* $OpenBSD: cmd-set-option.c,v 1.116 2017/05/31 17:56:48 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.117 2017/06/23 15:36:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
TAILQ_FOREACH(loop, &clients, entry)
server_client_set_key_table(loop, NULL);
}
+ if (strcmp(name, "user-keys") == 0) {
+ TAILQ_FOREACH(loop, &clients, entry) {
+ if (loop->tty.flags & TTY_OPENED)
+ tty_keys_build(&loop->tty);
+ }
+ }
if (strcmp(name, "status") == 0 ||
strcmp(name, "status-interval") == 0)
status_timer_start_all();
-/* $OpenBSD: key-string.c,v 1.46 2017/06/12 07:04:24 nicm Exp $ */
+/* $OpenBSD: key-string.c,v 1.47 2017/06/23 15:36:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
static key_code
key_string_search_table(const char *string)
{
- u_int i;
+ u_int i, user;
for (i = 0; i < nitems(key_string_table); i++) {
if (strcasecmp(string, key_string_table[i].string) == 0)
return (key_string_table[i].key);
}
+
+ if (sscanf(string, "User%u", &user) == 1 && user < KEYC_NUSER)
+ return (KEYC_USER + user);
+
return (KEYC_UNKNOWN);
}
return ("MouseMoveStatus");
if (key == KEYC_MOUSEMOVE_BORDER)
return ("MouseMoveBorder");
+ if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {
+ snprintf(out, sizeof out, "User%u", (u_int)(key - KEYC_USER));
+ return (out);
+ }
/*
* Special case: display C-@ as C-Space. Could do this below in
-/* $OpenBSD: options-table.c,v 1.89 2017/06/03 17:43:01 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.90 2017/06/23 15:36:52 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
.separator = ","
},
+ { .name = "user-keys",
+ .type = OPTIONS_TABLE_ARRAY,
+ .scope = OPTIONS_TABLE_SERVER,
+ .default_str = "",
+ .separator = ","
+ },
+
{ .name = "assume-paste-time",
.type = OPTIONS_TABLE_NUMBER,
.scope = OPTIONS_TABLE_SESSION,
-.\" $OpenBSD: tmux.1,v 1.562 2017/06/09 16:01:39 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.563 2017/06/23 15:36:52 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 9 2017 $
+.Dd $Mdocdate: June 23 2017 $
.Dt TMUX 1
.Os
.Sh NAME
was given to the
.Ic set-environment
command).
+.It Ic user-keys[] Ar key
+Set list of user-defined key escape sequences.
+Each item is associated with a key named
+.Ql User0,
+.Ql User1,
+and so on.
+.Pp
+For example:
+.Bd -literal -offset indent
+set -s user-keys[0] '\e[5;30012~'
+bind User0 resize-pane -L 3
+.Ed
.It Xo Ic visual-activity
.Op Ic on | off
.Xc
-/* $OpenBSD: tmux.h,v 1.786 2017/06/12 07:04:24 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.787 2017/06/23 15:36:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define KEYC_NONE 0xffff00000000ULL
#define KEYC_UNKNOWN 0xfffe00000000ULL
#define KEYC_BASE 0x000010000000ULL
+#define KEYC_USER 0x000020000000ULL
+
+/* Available user keys. */
+#define KEYC_NUSER 1000
/* Key modifier bits. */
#define KEYC_ESCAPE 0x200000000000ULL
-/* $OpenBSD: tty-keys.c,v 1.98 2017/06/12 07:04:24 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.99 2017/06/23 15:36:52 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
{
const struct tty_default_key_raw *tdkr;
const struct tty_default_key_code *tdkc;
- u_int i;
- const char *s;
+ u_int i, size;
+ const char *s, *value;
+ struct options_entry *o;
if (tty->key_tree != NULL)
tty_keys_free(tty);
tty_keys_add(tty, s, tdkc->key);
}
+
+ o = options_get(global_options, "user-keys");
+ if (o != NULL && options_array_size(o, &size) != -1) {
+ for (i = 0; i < size; i++) {
+ value = options_array_get(o, i);
+ if (value != NULL)
+ tty_keys_add(tty, value, KEYC_USER + i);
+ }
+ }
}
/* Free the entire key tree. */