Add C-g to cancel command prompt with vi(1) keys as well as emacs, and q

in command mode.
This commit is contained in:
nicm
2020-03-12 09:49:43 +00:00
parent 2a5702a936
commit b8b48e2e37
2 changed files with 5 additions and 1 deletions

View File

@ -733,6 +733,7 @@ status_prompt_translate_key(struct client *c, key_code key, key_code *new_key)
if (c->prompt_mode == PROMPT_ENTRY) { if (c->prompt_mode == PROMPT_ENTRY) {
switch (key) { switch (key) {
case '\003': /* C-c */ case '\003': /* C-c */
case '\007': /* C-g */
case '\010': /* C-h */ case '\010': /* C-h */
case '\011': /* Tab */ case '\011': /* Tab */
case '\025': /* C-u */ case '\025': /* C-u */
@ -813,6 +814,9 @@ status_prompt_translate_key(struct client *c, key_code key, key_code *new_key)
case 'p': case 'p':
*new_key = '\031'; /* C-y */ *new_key = '\031'; /* C-y */
return (1); return (1);
case 'q':
*new_key = '\003'; /* C-c */
return (1);
case 's': case 's':
case KEYC_DC: case KEYC_DC:
case 'x': case 'x':

2
tmux.1
View File

@ -4837,7 +4837,7 @@ on the value of the
option: option:
.Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent .Bl -column "FunctionXXXXXXXXXXXXXXXXXXXXXXXXX" "viXXXX" "emacsX" -offset indent
.It Sy "Function" Ta Sy "vi" Ta Sy "emacs" .It Sy "Function" Ta Sy "vi" Ta Sy "emacs"
.It Li "Cancel command prompt" Ta "Escape" Ta "Escape" .It Li "Cancel command prompt" Ta "q" Ta "Escape"
.It Li "Delete from cursor to start of word" Ta "" Ta "C-w" .It Li "Delete from cursor to start of word" Ta "" Ta "C-w"
.It Li "Delete entire command" Ta "d" Ta "C-u" .It Li "Delete entire command" Ta "d" Ta "C-u"
.It Li "Delete from cursor to end" Ta "D" Ta "C-k" .It Li "Delete from cursor to end" Ta "D" Ta "C-k"