40

I have the following in my .tmux.conf

set -g prefix M-j
bind-key j  send-prefix

I need to press (Atl+J) + (J) + bound-key to send something to the nested tmux session. I feel it is rather slow. Is there any better way? For example, I would love to be able to do (Alt+J) + (2x bound-key) to do stuff in the nested session. I constantly execute commands in the top tmux session instead of executing them in the nested one. Also, how come everybody binds prefix to C-a? I find it awfully slow and unpleasant to type this combination. Am I missing something?

5
  • While I don't like Ctrl-A either, your comment about its unpleasantness suggests that your pinky is reaching down to the control key maybe. If so, you might consider remapping capslock as a control key -- this is what I do to keep my finger-twisting under control, and then Ctrl+A is also less challenging.
    – Stabledog
    May 17, 2014 at 12:30
  • @Stabledog your assumption is right. Nevertheless, I mapped capslock to ESC. How do you press capslock + a?
    – Rolf
    May 22, 2014 at 13:34
  • The C-a combo lives on from GNU Screen, which predates tmux.
    – Kusalananda
    Oct 9, 2015 at 6:54
  • map capslock to esc on tap and ctrl on hold. use ctrl+s that way you only have to move one finger to press your prefix if using standard qwerty home row layout...
    – ipatch
    Apr 11, 2023 at 18:39
  • tinyurl.com/finger-splits
    – ipatch
    Apr 11, 2023 at 18:46

3 Answers 3

41

It is one less keypress to send a command to your nested session if you choose a different key. I use Ctrlt for my standard prefix, and Ctrla for nested sessions.

# set prefix key to ctrl+t
unbind C-b
set -g prefix C-t

# send the prefix to client inside window
bind-key -n C-a send-prefix

Note that I use the -n switch. From the bind-key entry in man tmux:

if -n is specified, it is not necessary to use the prefix key, command is bound to key alone.

So, as an example, Ctrlt, c opens a new window in tmux; Ctrla, c does the same in the nested session.

2
  • Awesome! This makes nested session actually as fast a normal sessions.
    – Rolf
    May 22, 2014 at 13:32
  • 3
    There is no need to unbind C-b if you got used to it. bind-key -n C-a send-prefix should be enough.
    – utapyngo
    May 12, 2016 at 12:14
0

The reason for ctrl-a is that most Unix hackers (that I know at least) remap caps lock to control. That makes all ctrl- ops faster, especially ctrl-a.

1
  • 6
    Yeah, as I said in a previous comment above: How on earth do you people press capslock+a at the same time? I use the pinky to either press one or the other.
    – Rolf
    Oct 19, 2017 at 11:57
0

Alternatively you can disable controls of the outer tmux session. Most of the time I want to control the inner session, so I use F12 as toggle hotkey.

You must log in to answer this question.

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