下面是配置文件內容,在家目錄下創建.tmux.conf,並粘貼下面內容保存后,進入tmux, ctrl+b,然后輸入命令:source-file ~/.tmux.conf 即可。
因為下面的命令中,bind了r作為source-file ~/.tmux.conf,所以在輸入ctrl+b之后輸入 r即可 reloaded
#將r 設置為加載配置文件,並顯示"reloaded!"信息
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Use Shift-arrow keys to switch panes
bind -n S-Left select-pane -L
bind -n S-Right select-pane -R
bind -n S-Up select-pane -U
bind -n S-Down select-pane -D
# Alt-arrow to switch windows
bind -n M-Left previous-window
bind -n M-Right next-window
#Enable mouse mode (tmux 2.1 and above)
setw -g mouse on
set -g mouse on
#Enable oh my zsh in tmux
set -g default-command /bin/zsh
# Mouse based copy
bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode MouseDragEnd1Pane send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
#開啟status-bar uft-8支持
set -g status-utf8 on
#設置終端顏色為256色
set -g default-terminal "screen-256color"
#開啟status-bar uft-8支持
set -g status-utf8 on
#設置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