Shell – Tmux stuck in copy-mode

shelltmux

After performing a keyboard shortcut in tmux (I am not sure which), I am put into a state of perpetual copy-mode. I can type normally, but every time I hit the n key it prompts to gotoline input.

If I close the pane it happens even on the new pane I have created.

Any help on how to exit this once it happens would be great, as all documentation surrounding copy-mode states that when you hit Esc or q you should leave copy-mode.

Best Answer

Typically I get out of copy mode using Enter. On another machine with different desktop environment and different terminal, this doesn't work in tmux. But I did find a way.

If you look at the definition of the cancel key in copy mode ( Ctrl+c and Ctrl+Esc ) that's defined as

bind-key    -T copy-mode    C-c               send-keys -X cancel

That means you can do Ctrl+b to enter command mode and then execute

send-keys -X cancel

This will take you out of copy mode.

Variation on the theme would be to change your key mode to vi ( unless you already use that or your EDITOR environment variable already set to it):

set -g mode-keys vi

This allows hitting q in copy mode to cancel the said mode


As for how to deal with the problem of n key and gotoline, I can't answer that. I'd suggest trying different terminal emulator or keyboard, since the issue may not be related to tmux at all.

Related Question