tmux FAQ

使用 vi mode

setw -g mode-keys vi

如何进行复制粘贴

http://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting/

  1. 使用 tmux buffer

增加配置:

#bind P paste-buffer
#bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
#bind-key -t vi-copy 'r' rectangle-toggle

复制:
PREFIX + [ 进入选择模式,
space 键选择开始字符,
y 结束选择, 并 copy 到 tmux buffer

粘贴:
PREFIX + ]

  1. 使用系统粘贴板

如何关闭自动重命名.

set-option -g allow-rename off

远程登录时, 显示空间很小的问题

方法一:

取消所有 client 的 attach 状态
tmux detach -a
tmux ls , 检查是否都 detach 了, 如果还不行, 那么
ps -ef | grep tmux, 找出还在 attach 某个 session 的 client, kill 之.

方法二 (未验证) :

使用以下设置, 那些点点就会被作为可用空间了. 可能是不同 client 的显示器不同导致.
set-window-option -g aggressive-resize

参考:
http://stackoverflow.com/questions/7814612/is-there-any-way-to-redraw-tmux-window-when-switching-smaller-monitor-to-bigger
https://superuser.com/questions/880497/how-do-i-resize-the-usable-area-of-a-tmux-session

ctrl + ( ← / → ) 不能生效

https://superuser.com/questions/360832/how-can-i-make-ctrlleft-right-keys-work-right-in-tmux

vim ~/.tmux.conf , 增加配置 :

set-window-option -g xterm-keys on

当前生效:

PREFIX + :set-window-option xterm-keys on

修改 前缀 组合键 (ctrl + b)

# 设置前缀键, 双引号表示字符串需要对 \ 进行转义 (\\)
set-option -g prefix 'C-\'

关闭鼠标模式

set -g mode-mouse off

延长 PREFIX + q 的显示时间

# 延长 pane indicators display time
set -g display-panes-time 1000

设置状态栏左侧

set -g status-left "#[fg=green] A good book is your best friend. #[fg=brightblue]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "

设置窗口格式文本

set -g window-status-format "#[fg=white,bg=colour234] #I.#W"

当前窗口 :

set -g window-status-current-format "#[fg=white]#[bg=blue,noreverse,bold] #I. #W #[fg=colour39,noreverse,bold] "

参考