近期因为误操作重新安装了系统,顺便重新修改了一下自己的.tmux.conf文件,特地记录如下
set -g default-terminal "screen-256color"
set -g history-limit 65535
# change prefix to ctrl+a
set -g prefix ^a
unbind ^b
# select pane like vim
bind k selectp -U # above (prefix k)
bind j selectp -D # below (prefix j)
bind h selectp -L # left (prefix h)
bind l selectp -R # right (prefix l)
# resize pane like vim (change 5 once)
bind -r ^k resizep -U 5 # upward (prefix Ctrl+k)
bind -r ^j resizep -D 5 # downward (prefix Ctrl+j)
bind -r ^h resizep -L 5 # to the left (prefix Ctrl+h)
bind -r ^l resizep -R 5 # to the right (prefix Ctrl+l)
# vim like copy and paste
setw -g mode-keys vi # vi like cursor movement in copy mode (like w to move to next word)
unbind [ # use escape to enter copy mode
bind Escape copy-mode
bind-key -t vi-copy 'v' begin-selection # use v to start selection (like visual mode in vim)
# bind-key -t vi-copy 'y' copy-selection
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard' # use y to copy to system clipboard (should install xclip first)
unbind p # use p to paste
bind p paste-buffer
# mouse support (for newer versions)
set -g mouse on