tmux 基础

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pengjian444/article/details/80451997

好资料

配置文件

## ~/.tmux.conf

# 基础设置
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g escape-time 0
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1

# 前缀绑定 (Ctrl+a)
set -g prefix ^a
unbind ^b
bind a send-prefix

# 分割窗口
unbind '"'
bind - splitw -v
unbind %
bind | splitw -h

# 选中窗口
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R

# copy-mode 将快捷键设置为 vi 模式
setw -g mode-keys vi

# 启用鼠标(Tmux v2.1)
set -g mouse on

# 更新配置文件
bind r source-file ~/.tmux.conf \; display "已更新"

#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# Tmux Plugin Manager(Tmux v2.1)
# Tmux Resurrect
set -g @plugin 'tmux-plugins/tmux-resurrect'

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

新建一个会话

tmux new -s session-name

查看已有会话

tmux ls

接入已有会话

tmux a   #接入上一个回话
tmux a -t session-name  # 接入固定名称的回话

detach 临时断开会话

C + a     d

关闭会话

# 先进入某一个会话,再关闭
tmux a -t session-name
exit

# 直接在最上层的shell里面关闭绘画
tmux kill-session -t session-name

切换窗口

ctrl + a     0/1 之类的,即窗口对应的数字

新建一个窗口

ctrl + a   c

调整pane大小

## 注:在打开鼠标之后,是可以通过鼠标来直接控制窗口大小的。所以,这个其实有点多余

PREFIX : resize-pane -D          当前窗格向下扩大 1 格
PREFIX : resize-pane -U          当前窗格向上扩大 1 格
PREFIX : resize-pane -L          当前窗格向左扩大 1 格
PREFIX : resize-pane -R          当前窗格向右扩大 1 格
PREFIX : resize-pane -D 20       当前窗格向下扩大 20 格
PREFIX : resize-pane -t 2 -L 20  编号为 2 的窗格向左扩大 20

猜你喜欢

转载自blog.csdn.net/pengjian444/article/details/80451997