tmux macOS 安装和简单配置使用

tmux macOS install

  • 1,tmux安装
  • 2,tmux快捷键
    • 2.1,会话session
    • 2.2,窗口window
    • 2.3,窗格pane

1,tmux安装

$ brew search tmux
$ brew install tmux

$ tmux -V                                                          │
tmux 2.9a

2,tmux快捷键

  • 创建tmux配置文件,默认的前缀快捷键 ⌃b (Ctrl + b ) 修改为 ⌃a ( Ctrl + a)
$ cd ~
$ touch .tmux.conf
$ cat .tmux.conf 
# Change the prefix key to C-a
set -g prefix C-a                          
unbind C-b                                 
bind C-a send-prefix 

  • tmux配置文件重载
tmux source-file ~/.tmux.conf
  • 绑定快捷键为r
$ cat .tmux.conf
# 绑定快捷键为r
bind r source-file ~/.tmux.conf \; display-message "Config reloaded.."

  • 修改为h横向分割,v纵向分割
$ cat .tmux.conf
# Set easier window split keys
bind-key v split-window -h
bind-key h split-window -v
$ cat .tmux.conf
# Use Alt-arrow keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

2.1,会话session

  • 新建会话并命名为s1
$ tmux new -s s1
  • 列出所有会话
$ tmux ls
  • 进入会话s1
tmux a -t s1
  • 断开当前会话,会话在后台运行
tmux detach 
  • Ctrl+a s 查看回话列表
  • Ctrl+a d 后台运行

2.2,窗口window

  • Ctrl+a c 新建窗口
  • Ctrl+a n 下一个窗口
  • Ctrl+a p 上一个窗口
  • Ctrl+a w 列出所有窗口
  • Ctrl+a , 重命名窗口

2.3,窗格pane

  • Ctrl+a x 关闭窗格(需要输入y)
  • Ctrl+a h 横向分割窗格
  • Ctrl+a v 纵向分隔窗格
  • Ctrl+a z 最大化当前窗格,再按一次恢复(不启用鼠标模式,方便鼠标选择文本进行复制操作)
  • Ctrl+a PgUp PgDn 翻页 q 退出

tmux macOS 安装和简单配置使用_第1张图片

参考;

  1. Tmux使用手册
  2. tmux简洁教程及config关键配置
  3. Tmux 快捷键 & 速查表

你可能感兴趣的:(Mac,OS)