1

I just started using tmux and trying to get a few bindings to work the same as on screen. One of the binding that I used very often on screen was to start copy mode and selection at the same time, as it is very useful when in vi (position the cursor where you want using vi commands, and start selecting with one command). I tried the below, but it doesn't work:

bind Space copy-mode ; send-keys Space

It starts the copy mode, but send-keys command seems to be ignored. I also tried sending the "[ Space" as a key sequence, but that didn't even switch the mode, though I can see they get sent literally. Is there a different way that this can be achieved?

1 Answer 1

3

You need to escape the semicolon so that it is part of the binding (multiple commands in the binding) instead of separating multiple commands in your configuration file (send-keys executed right after bind-key when your server is first starting up).

bind Space copy-mode \; send-keys Space

If you happen to make this binding from the command line you need to escape it once for tmux and once again for the shell:

tmux bind Space copy-mode \\\; send-keys Space

# OR

tmux bind Space copy-mode '\;' send-keys Space
2
  • Thank you, and bonus points for explaining why it is needed.
    – haridsv
    Jan 23, 2013 at 8:56
  • Does this still work with new tmux versions? not working on my side.
    – SFbay007
    Mar 1, 2021 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .