refer
download
基本介绍
- session与panel区别
本质上没有区别,但是最好是一个session里面不要超过10个window,这样方便使用0-9的数字进行切换
常用快捷键
自带功能/快捷键
光标在单词间快速跳转 alt+左/右
zsh也是这样,但是bash就是ctrl+左右
需要设置
tmux new -s [session-name]
tmux attach -t [session-name]
tmux ls
tmux switch -t <session-name>
tmux rename-session -t 0 <new-name>
tmux kill-session -t [session-name] # 删除指定会话
tmux kill-server # 删除所有会话
进入tmux界面之后
# 窗口选择
prefix [number] # 选择第n个窗口
prefix p/n # 选择前/后一个窗口
prefix c # create : 创建新窗口(window)
prefix " # 上下分割panel
prefix % # 左右分割panel
prefix s # 显示所有session
prefix w # 显示当前session的所有windows
prefix z # zoom : 平铺当前窗口(放大/缩小)
prefix [ # 启用鼠标滚屏
# 重命名(在命令行模式中)
rename-session [-t current-name] [new-name]
rename-window [-t current-name] [new-name]
rename-window 的current-nam用该window的序号也可以。比如:
rename-window -t 0 fitlog
就可以把序号为1的窗口名字改为fitlog(而不用管现在的名字是什么)
-
调整窗格(panel)大小
开启鼠标模式之后 , 就可以直接用鼠标去拖动窗格大小了 -
调整窗格位置
prefix + { / } # 往左(上) /右(下) prefix + space # 各种排版切换 prefix + ctrl+o # 顺时针移动panel
常见问题
如何source ~/.tmux.conf
another reference
应该在终端内部进行source-file的命令,如果是在外部的话,就用:
tmux source-file ~/.tmux.conf
bind C-c run " tmux save-buffer - | xclip -i -sel clipboard"
Linux系统粘贴板内容复制到会话
bind C-v run " tmux set-buffer “$(xclip -o -sel clipboard)”; tmux paste-buffer"
设置完set -g mouse on后
> 来源于[此blog](http://louiszhai.github.io/2017/09/30/tmux/#%E7%81%B5%E6%B4%BB%E7%9A%84%E9%85%8D%E7%BD%AE%E6%80%A7)* 强制分离会话中的现有客户端
* refer : [如何分离本身已在tmux中的tmux会话?](https://qastack.cn/superuser/249659/how-to-detach-a-tmux-session-that-itself-already-in-a-tmux) & [tmux 如何让其他终端断开连接?](https://blog.youkuaiyun.com/henryhu712/article/details/83833060)
```bash
# 方法1
tmux attach -d
# 方法2
进入会话后 前缀键+D (注意,是大写的D)
```