美文网首页
Tmux 安装 & 配置

Tmux 安装 & 配置

作者: RoyTien | 来源:发表于2021-08-07 16:26 被阅读0次

安装

依赖

  • tmux depends on libevent 2.x, and ncurses
  • To build tmux, a C compiler (for example gcc or clang), make, pkg-config and a suitable yacc (yacc or bison) are needed.
Platform Command Run
Debian apt-get install libevent; ncurses
RHEL or CentOS yum install libevent; ncurses

Tmux

Platform Install Command Version
Debian or Ubuntu apt install tmux 2.8
RHEL or CentOS yum install tmux 1.8
macOS brew install tmux

配置 Oh my tmux

Requirements:

  • tmux >= 2.3 (soon >= 2.4) running inside Linux, Mac, OpenBSD, Cygwin or WSL
  • awk, perl and sed
  • outside of tmux, $TERM must be set to xterm-256color

Install

To install, run the following from your terminal: (you may want to backup your existing ~/.tmux.conf first)

$ cd
$ git clone https://github.com/gpakosz/.tmux.git
$ ln -s -f .tmux/.tmux.conf
$ cp .tmux/.tmux.conf.local .

如果需要编辑你自己的配置,你可以修改 .tmux.conf.local 配置。

鼠标模式

这个配置默认没开鼠标模式,可以手动打开:

vim ~/.tmux.conf.local
# /mouse 回车
# 找到下面这一行:
# set -g mouse on
# 把前面的 # 去掉就好了

# 2.1版之前要开鼠标模式要输入4个命令
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on

# 2.1之后就只要一句就可以了
set -g mouse on

# github 上的版本 >= 2.2

# 然后在 tmux 里 
Ctrl+b
Shift+;
source-file ~/.tmux.conf
# 重新加载配置文件

vi模式

# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
set -g status-keys vi
set -g mode-keys vi

使用

  • 新建会话 tmux new -s name
  • 在 tmux 窗口运行所需的程序。
  • 按下快捷键 Ctrl+b + d 将会话分离。(可选)
  • 下次使用时,重新连接到会话 tmux a -t my_session
  • 水平分屏 <prefix> + %
  • 垂直分屏 <prefix> + "
  • 移动光标 <prefix> + o

相关文章

网友评论

      本文标题:Tmux 安装 & 配置

      本文链接:https://www.haomeiwen.com/subject/aqqgvltx.html