aboutsummaryrefslogtreecommitdiff
path: root/cmd-command-prompt.c
diff options
context:
space:
mode:
authornicm <nicm>2020-01-27 08:53:13 +0000
committernicm <nicm>2020-01-27 08:53:13 +0000
commitd0b8d036be97efc885f879aa63ce9bbb0efd8222 (patch)
tree44cfbf25fe998698cd423eb5a88a572426929715 /cmd-command-prompt.c
parent2e39b621c9b29b58b4bfe761989b14f0f13d07b6 (diff)
downloadrtmux-d0b8d036be97efc885f879aa63ce9bbb0efd8222.tar.gz
rtmux-d0b8d036be97efc885f879aa63ce9bbb0efd8222.tar.bz2
rtmux-d0b8d036be97efc885f879aa63ce9bbb0efd8222.zip
Add support for adding a note to a key binding (with bind-key -N) and
use this to add descriptions to the default key bindings. A new -N flag to list-keys shows key bindings with notes rather than the default bind-key command used to create them. Change the default ? binding to use this to show a readable summary of keys. Also extend command-prompt to return the name of the key pressed and add a default binding (/) to show the note for the next key pressed Suggested by Alex Tremblay in GitHub issue 2000.
Diffstat (limited to 'cmd-command-prompt.c')
-rw-r--r--cmd-command-prompt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index 603ddb0a..9f0ea19f 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -40,8 +40,8 @@ const struct cmd_entry cmd_command_prompt_entry = {
.name = "command-prompt",
.alias = NULL,
- .args = { "1iI:Np:t:", 0, 1 },
- .usage = "[-1Ni] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " "
+ .args = { "1kiI:Np:t:", 0, 1 },
+ .usage = "[-1kiN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " "
"[template]",
.flags = 0,
@@ -122,6 +122,8 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
cdata->flags |= PROMPT_NUMERIC;
else if (args_has(args, 'i'))
cdata->flags |= PROMPT_INCREMENTAL;
+ else if (args_has(args, 'k'))
+ cdata->flags |= PROMPT_KEY;
status_prompt_set(c, prompt, input, cmd_command_prompt_callback,
cmd_command_prompt_free, cdata, cdata->flags);
free(prompt);