下面是~/.tmux.config
文件内容,为了要实现tmux和系统剪切板的同步需要apt-get install xclip
#设置终端颜色为256色
set -g default-terminal "screen-256color"
#设置pan前景色
#set -g pane-border-fg green
#设置pane背景色
set -g pane-border-bg black
#设置活跃pane前景色
set -g pane-active-border-fg white
#设置活跃pane背景色
set -g pane-active-border-bg yellow
#设置消息前景色
set -g message-fg white
#设置消息背景色
set -g message-bg black
#设置消息高亮显示
set -g message-attr bright
#设置status-bar颜色
set -g status-fg white
set -g status-bg black
#设置窗口列表颜色
setw -g window-status-fg cyan
setw -g window-status-bg default
setw -g window-status-attr dim
#设置当前窗口在status bar中的颜色
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright
#设置status bar格式
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set -g status-right "#[fg=cyan]%b %d %R"
set -g status-interval 60
set -g status-justify centre
set -g base-index 1 # 窗口编号从 1 开始计数
set -g display-panes-time 10000 # PREFIX-Q 显示编号的驻留时长,单位 ms
set -g mouse on # 开启鼠标
set -g pane-base-index 1 # 窗格编号从 1 开始计数
set -g renumber-windows on # 关掉某个窗口后,编号重排
# 启用活动警告
setw -g monitor-activity on
set -g visual-activity on
# split panes using | and -
bind l split-window -h #扩展窗口
bind j split-window -v
unbind '"'
unbind %
#移动扩展出的窗口
bind C-k select-pane -U #向上
bind C-j select-pane -D #向下
bind C-h select-pane -L #向左
bind C-l select-pane -R #向右
bind b resize-pane -Z #b全屏
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' #复制到系统剪切板
bind-key -T copy-mode-vi C-h select-pane -L #复制模式时移动光标
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l