From 9f6164a05cc0de372f6859127f72c8b242596bf5 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 5 Oct 2021 12:49:37 +0000 Subject: [PATCH] Make send-keys without any arguments send the key it is bound to (if any). GitHub issue 2904. --- cmd-send-keys.c | 6 ++++++ tmux.1 | 1 + 2 files changed, 7 insertions(+) diff --git a/cmd-send-keys.c b/cmd-send-keys.c index 44b796ba..47fa1caa 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -202,6 +202,12 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item) wp->flags |= (PANE_STYLECHANGED|PANE_REDRAW); } + if (count == 0) { + for (; np != 0; np--) + cmd_send_keys_inject_key(item, NULL, event->key); + return (CMD_RETURN_NORMAL); + } + for (; np != 0; np--) { for (i = 0; i < count; i++) { after = cmd_send_keys_inject_string(item, after, args, diff --git a/tmux.1 b/tmux.1 index d48415fe..46611df2 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3123,6 +3123,7 @@ or to send; if the string is not recognised as a key, it is sent as a series of characters. All arguments are sent sequentially from first to last. +If no keys are given and the command is bound to a key, then that key is used. .Pp The .Fl l