4

Let's say I'm running ranger inside tmux session, but I want to send a keyboard shortcut to ranger (e.g. Ctrl+H) which is already used in tmux.

Is there a passthrough mode to send key binding to underlying program similar to vim's Ctrl+O in "insert mode"?

I know you can set a key bind to send a key bind, but that's not practical to map all other program key bind.

1 Answer 1

4

You can use send-keys:

C-b : send C-h

C-h is not a key used by tmux by default (precisely so you don't need to do this).

If you are running 3.1 or master you could try something like this to make a key which sends the next key:

bind -n C-o command-prompt -kp key 'send %%%'
4
  • As I mentioned above, it's unpractical to map specific key since I need to send whatever shortcut below
    – Kuntau
    May 14, 2020 at 21:13
  • I didn't suggest mapping specific keys, I gave you two examples that will work for any key. But if you are regularly wanting to use C-h or any other key in applications inside tmux, it is probably an unwise choice for a key for tmux itself. May 14, 2020 at 21:26
  • Ahh.. I just got your edit... I'll try the 2nd one
    – Kuntau
    May 14, 2020 at 21:52
  • The second one worked. Thanks.
    – xji
    Sep 27, 2020 at 13:43

You must log in to answer this question.

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