Skip to content

Commit

Permalink
update tmuxcc
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong committed Dec 17, 2023
1 parent 22735d8 commit 79430e1
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions cn/tmuxcc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,39 @@ layout: default

# iTerm2 与 tmux -CC 集成

`iTerm2` 支持与 `tmux -CC` 控制模式集成,只要在 `iTerm2` 中使用 `tmux` 时加上 `-CC` 参数即可。
`iTerm2` 无须记住 `tmux` 的命令和快捷键,即可方便地新开窗口和分屏,断开后又能恢复所有。

使用方法超级简单,只要在 `iTerm2` 中使用 `tmux` 时加上 `-CC` 参数即可:

- 例如:`tmux` 变成 `tmux -CC`
- 又如:`tmux new-session -A -s xxx` 变成 `tmux -CC new-session -A -s xxx`

`~/.ssh/config` 中如下配置,`ssh` 登录即自动恢复上次所有窗口和程序,意外断开时程序也会继续运行:

```
Host xxxxx
RequestTTY Yes
RemoteCommand tmux -u -CC new-session -A -D -X -s yyyyy /bin/bash
# 以上 xxxxx 和 yyyyy 你可以替换成任意你喜欢的名称
```

iTerm2 的文档:[tmux Integration](https://iterm2.com/documentation-tmux-integration.html)

## 常用快捷键介绍

以下快捷键属于 `iTerm2`,兼容未使用 `tmux` 的场景。

- `command + t` 新开 tab 窗口
- `command + d` 左右分屏
- `command + shift + d` 上下分屏
- `command + [``command + ]` 切换分屏
- `command + <-``command + ->` 切换 tab 窗口
- `command + shift + enter` 将某个分屏全屏化,或还原
- `command + fn + <-` 滚动到当前输出的最前面
- `command + fn + ->` 滚动到当前输出的最后面
- `command + k` 清空当前的所有输出
- `command + control + shift + d` 分离 tmux,重新连接会恢复打开的所有窗口

## 隐藏 tmux 控制窗口

在默认情况下,运行 `tmux -CC` 后,`iTerm2` 会显示两个窗口,原窗口会如下显示:
Expand Down Expand Up @@ -36,13 +64,6 @@ esc Detach cleanly.

设置后运行 `tmux -CC` 试试,就能看出每种方式有什么不同,这里不再赘述。

## 常用快捷键介绍

- `command + d` 左右分屏
- `command + shift + d` 上下分屏
- `command + t` 新开一个 tab 窗口
- `command + control + shift + d` 分离 tmux,运行 `tmux -CC attach` 重新连接会恢复原来打开的所有窗口。

## 隐藏分屏标题栏

在默认情况下,使用 `tmux -CC` 分屏的窗口会显示一行标题栏,非常丑。
Expand Down

0 comments on commit 79430e1

Please sign in to comment.