【发布时间】:2013-07-29 09:54:09
【问题描述】:
我想在我的开发 tmux 会话中使用我的 ssh tmux 会话,但这会使 tmux 表现不佳(密钥进入错误的会话等)。有没有办法正确地做到这一点?
【问题讨论】:
我想在我的开发 tmux 会话中使用我的 ssh tmux 会话,但这会使 tmux 表现不佳(密钥进入错误的会话等)。有没有办法正确地做到这一点?
【问题讨论】:
你可以设置
bind-key b send-prefix
在您的.tmux.conf 中。默认情况下,所有命令都转到最外层的 tmux 会话。如果您按<prefix-key>b(默认为<prefix-key>=ctrlb),命令将转到内部会话。举个例子:
ctrl-b c # create new window in the outer session
ctrl-b b c # create new window in the inner session
ctrl-b % # create split window in the outer session
ctrl-b b % # create split window in the inner session
【讨论】:
至少在我的机器上,我需要按两次“键”(前缀键),才能获得对基础 tmux 内的 tmux 的命令,
因此,如果我从 tmux 窗口 ssh 进入服务器并附加到上述@Marco 的 tmux 会话,我需要执行以下操作:
ctrl-b-b c # create a new window on the server (remote tmux)
ctrl-b c # create a new window on my desktop (local tmux)
做起来超级清楚,ctrl-b-b表示按住ctrl按两次b然后松开再按命令键,上例中c。
【讨论】: