6
votes

I was trying to find a command for "leaving copy-mode" from this page, but it seems only the key binding prefix+q exists for this function; i.e., I can't find the associated :command-style command.

Does this mean it is impossible to bind another key to "leave copy-mode"? I'd like to bind the Esc key.

1

1 Answers

11
votes

Copy mode uses its own set of commands, separate from tmux itself. Use send-keys -X to "type" commands in copy mode, as demonstrated by the default binding for exiting copy mode:

bind-key    -T copy-mode    q                 send-keys -X cancel

Note that Escape is already bound to the same command, at least in tmux 2.7.

% tmux list-keys | grep "send-keys -X cancel"
bind-key    -T copy-mode    C-c               send-keys -X cancel
bind-key    -T copy-mode    Escape            send-keys -X cancel
bind-key    -T copy-mode    q                 send-keys -X cancel
bind-key    -T copy-mode-vi C-c               send-keys -X cancel
bind-key    -T copy-mode-vi q                 send-keys -X cancel

The page you were referring to is not a comprehensive list of tmux commands, but rather a comparison of how to accomplish some common tasks in different terminal multiplexers.