在 tmux 中的会话之间切换?

问题描述 投票:0回答:8

我对 tmux 比较陌生,只是将它用于本地开发。在某些 tmux 教程中,人们会在枚举列表中列出他们的 tmux 会话。通常有黄色高光。有谁知道我在说什么以及如何去做?其次,你会说这是最佳实践吗?我在这里打开了 8 个 iTerm2 选项卡:(

这是我正在寻找的截图:

tmux tmuxinator
8个回答
163
投票

ctrl+b, s

注意ctrl+b是我的前缀,你的前缀可以是别的。


47
投票

您正在寻找

C-b (
C-b )
。您可以在 tmux 备忘单 上找到这个和更多精彩技巧。


12
投票

PREFIX s
,但真正的命令是选择树。然后你可以用它来绑定到其他键,例如'S'

bind S choose-tree

http://man.openbsd.org/OpenBSD-current/man1/tmux.1#choose-tree


8
投票

如果要即时切换,请使用

tmux switch -t [target-session]


7
投票

如果你

man tmux
你会发现一个tmux选项列表:

C-( Switch the attached client to the previous session.
C-) Switch the attached client to the next session.

无需更改您的 tmux.conf


4
投票

Ctrl-b Shift-9Ctrl-b Shift-0


3
投票

例如,使用 shell 别名可以通过名称进行更快的切换。对于 zsh,它可以如下所示:

function tn() (
    if [ -n "$1" ]
      then
         tmux switch -t $1
      else
         echo "no session name"
     fi
  )

使用

tn go
切换到名称为 go 的 tmux 会话。


0
投票

你也可以做

tmux switch -t <session name or number>
C-b )
转发或
C-b (
转发漂亮的参考:https://tmuxcheatsheet.com/

© www.soinside.com 2019 - 2024. All rights reserved.