# ---- general ---------------------------------------------------- set -g default-terminal "screen-256color" # colors! setw -g xterm-keys on set -s escape-time 10 # faster command sequences set -sg repeat-time 600 # increase repeat timeout set -s focus-events on #unbind ^b # unbind defaul prefix Control+b #set -g prefix 'C-\' # bind new prefix Control+a #bind-key 'C-\' send-prefix bind r source-file ~/.tmux.conf \; display-message "tmux config reloaded" # create new short cut to reload tmux.conf set -q -g status-utf8 on setw -q -g utf8 on set -g history-limit 5000 # boost history # ---- display ------------------------------------------------------------------------ # Enable mouse mode (tmux 2.1 and above) set -g mouse on # setw -g mode-mouse on # 窗口号和窗口分割号都以1开始(默认从0开始) set -g base-index 1 # start windows numbering at 1 setw -g pane-base-index 1 # make pane numbering consistent with windows setw -g automatic-rename on # rename window to reflect current program set -g renumber-windows on # renumber windows when a window is closed # 监视窗口信息,如有内容变动,进行提示 set -g monitor-activity on set -g visual-activity off # 调节窗口大小快捷键 bind -r H resize-pane -L 5 bind -r J resize-pane -D 5 bind -r K resize-pane -U 5 bind -r L resize-pane -R 5 # move between panels using hjkl like in vim up #bind-key k select-pane -U #down #bind-key j select-pane -D #left #bind-key h select-pane -L #right #bind-key l select-pane -R # switch panes using Alt-arrow without prefix # bind -n 表示绑定到全局,不需要 # bind -r 表示可以重复 # 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 # split panes using | and - bind | split-window -h -c "#{pane_current_path}" bind - split-window -v -c "#{pane_current_path}" unbind '"' unbind % bind-key -t vi-copy 'v' begin-selection bind-key -t vi-copy 'y' copy-selection # Smart pane switching with awareness of Vim splits. # See: https://github.com/christoomey/vim-tmux-navigator is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" # bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" 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 # -------------------------------- color begin -------------------------------- # fiddle with colors of status bar set -g status-fg white set -g status-bg colour234 # 底部状态背景 set -g status-interval 10 # redraw status line every 10 seconds # 对齐方式 set-option -g status-justify centre # fiddle with colors of inactive windows # change color of active window # setw -g window-status-current-fg white # setw -g window-status-current-bg colour234 # setw -g window-status-current-attr bright # set color of regular and active panes # set -g pane-border-fg colour238 # set -g pane-border-bg default # set -g pane-active-border-fg green # set -g pane-active-border-bg default # set color of command line set -g message-fg white set -g message-bg colour22 set -g message-attr bright set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' set -g status-right-length 50 # 设置当前窗口格式及颜色 setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W " setw -g window-status-current-bg colour0 setw -g window-status-current-fg colour11 setw -g window-status-current-attr dim setw -g window-status-fg cyan setw -g window-status-bg colour234 setw -g window-status-attr dim # automatic install tpm if "test ! -d ~/.tmux/plugins/tpm" \ "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' # Other examples: # set -g @plugin 'github_username/plugin_name' # set -g @plugin 'git@github.com/user/plugin' # set -g @plugin 'git@bitbucket.com/user/plugin' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'