Skip to content

Instantly share code, notes, and snippets.

@andelf
Created January 21, 2020 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andelf/473e3cfbdcd55b41946418c5fbab5273 to your computer and use it in GitHub Desktop.
Save andelf/473e3cfbdcd55b41946418c5fbab5273 to your computer and use it in GitHub Desktop.
.tmux.conf
#设置终端颜色为256色
set -g default-terminal "screen-256color"
# auto resize to smallest windows size
setw -g aggressive-resize on
# Terminal emulator window titles
set -g set-titles on
set -g set-titles-string "#T"
#将激活控制台的快捷键由Ctrl+b修改为Ctrl+z
set-option -g prefix C-z
unbind-key C-b
bind-key C-z send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
bind r source-file ~/.tmux.conf \; display-message "Reloaded tmux.conf"
# switch panes using Alt-arrow without prefix
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
# Enable mouse mode (tmux 2.1 and above)
set -g mouse off
######################
### DESIGN CHANGES ###
######################
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour30 fg=colour133'
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour32] %Y%m%d #[fg=colour233,bg=colour36] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
#此类配置可以在命令行模式中输入show-options -g查询
set-option -g base-index 1 #窗口的初始序号;默认为0,这里设置为1
set-option -g display-time 5000 #提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set-option -g repeat-time 1000 #控制台激活后的持续时间;设置合适的时间以避免每次操作都要先激活控制台,单位为毫秒
set-option -g status-style "fg=colour0,bg=colour12"
set-option -g mode-style "fg=#ffd787,bg=#5f8700"
set-option -g message-style "fg=black,bg=#8ae234"
set-option -g display-panes-colour white
set-option -g display-panes-active-colour red
setw -g window-status-current-style 'fg=colour1 bg=colour20 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-style 'fg=colour9 bg=colour17'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style 'fg=colour255 bg=colour20 bold'
# messages, command input
set -g message-style 'fg=colour232 bg=colour10 bold'
#此类设置可以在命令行模式中输入show-window-options -g查询
set-window-option -g mode-keys emacs #复制模式中的默认键盘布局;可以设置为vi或emacs
#添加自定义快捷键
#bind-key z kill-session #按z结束当前会话;相当于进入命令行模式后输入kill-session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment