MDGSF Software Engineer

[Linux] tmux 软件

2018-11-13

~/.tmux.conf

#
# ~/.tmux.conf
#
# server | 服务器| 输入tmux命令时就开启了一个服务器
# session | 会话 | 一个服务器可以包含多个会话
# window | 窗口 | 一个会话可以包含多个窗口
# panel | 面板 | 一个窗口可以包含多个面板
#
# 使该文件 .tmux.conf 生效
# 在正常 console 下,执行 tmux source-file ~/.tmux.conf
#
# tmux kill-server 关闭 tmux
#
###### 会话
#
# tmux 进入tmux, 这个时候应该是创建了一个新的会话
# ctrl+b ctrl+z 挂起当前会话,可以使用 jobs 查看,fg 恢复该会话
# ctrl+b d 离开当前会话,进入 shell, 需要在 shell 中输入 tmux attach 才能重新进入
# tmux ls 查看所有会话
# tmux attach -t 0 ### attach 到一个会话,这里的 0 是会话的名字
# tmux new -s database 创建一个名字为 database 的会话
# tmux rename-session -t database data 把会话database重命名为data
#
###### 窗口
#
# ctrl+b c 创建一个新窗口
# ctrl+b & 关闭当前窗口
# ctrl+b 1/2/3/数字 切换窗口
# ctrl+b l 转到上一个使用的窗口。
# ctrl+b n 转到下一个 (n)ext 窗口。
# ctrl+b p 转到之前的 (p)revious 窗口。
# ctrl+b w 打开窗口列表,用方向键,hjkl切换窗口。
# ctrl+b , 重命名当前窗口。
# ctrl+b . 修改当前窗口的编号。
#
#
###### 面板
#
# ctrl+b " 水平分割面板
# ctrl+b % 竖直分割面板
# ctrl+b x 关闭当前面板
# ctrl+d 关闭面板
# 输入exit 关闭面板
# ctrl+b 方向键 选择面板
# ctrl+b ctrl+o 顺时针旋转面板,光标不动
# ctrl+b alt+o 逆时针旋转面板,光标不动
# ctrl+b o 光标顺时针移动到下一个面板
# ctrl+b t 显示当前时间
# ctrl+b ctrl+方向键 调整面板大小
# ctrl+b alt+方向键 调整面板大小
# ctrl+b space 在内置的几种面板之间切换
#
# ctrl+b z : make a pane go full screen. Hit again to shink it back to its
#
#
###### 查看历史消息
# ctrl+b 进入 copy mode
# PageUp 光标向上移动
# PageDown 光标向下移动
# 按 q 退出 copy mode
#
#
###### 复制模式
#
# ctrl+b [ 进入复制模式
# 用 vim 操作移动光标
# space 开始复制
# enter 复制完成
# ctrl+b ] 粘贴
#
#
###### 其他
#
# ctrl+b ? 查看所有快捷键
#


# modify leader
# unbind C-a
# set -g prefix C-b

# 使用 alt-left/right/up/down 来选择面板
# 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
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D

set-option -g base-index 1
set-option -g display-time 5000
set-option -g repeat-time 1000

set-window-option -g mode-keys vi

set -g mouse on

set -s escape-time 0

# apt-get install xclip
# 先用 ctrl+b [ 进入复制模式复制
# 然后用 ctrl+b ctrl+c 把 tmux 缓冲区中的内容复制到系统剪切板
# 用 ctrl+b ctrl+v 把系统剪切板复制到 tmux
bind C-c run " tmux save-buffer - | xclip -i -sel clipboard > /dev/null"
bind C-v run " tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"

bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

参考链接

https://github.com/tmux/tmux

https://blog.csdn.net/gatieme/article/details/49301037


weixingongzhonghao

Similar Posts

Comments