Skip to content

Instantly share code, notes, and snippets.

@bwangelme
Created October 27, 2019 08:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwangelme/4aa353ea31499166a0a534548ce2be7d to your computer and use it in GitHub Desktop.
Save bwangelme/4aa353ea31499166a0a534548ce2be7d to your computer and use it in GitHub Desktop.
tmux 配置
unbind ^b
set -g prefix 'C-x'
# 设置窗口的数字从1开始
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display-message "Config reload"
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind H resize-pane -L 10 # 向左扩展
bind L resize-pane -R 10 # 向右扩展
bind K resize-pane -U 5 # 向上扩展
bind J resize-pane -D 5 # 向下扩展
bind '-' split-window -c '#{pane_current_path}'
bind '|' split-window -h -c '#{pane_current_path}'
bind 't' new-window -c "#{pane_current_path}"
bind 'c' copy-mode
bind '[' previous-window
bind ']' next-window
set -g mouse on # 开启鼠标
set -sg escape-time 0 # 关闭Esc键的延迟
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
set-option -g allow-rename off # 窗口创建后不使用新命名的窗口
set-option -g history-limit 10000 # 滚动历史
# 状态栏配置 {
set-option -g status-position bottom
# 自动重新编号 window
set -g renumber-windows on
# 设置自动刷新的时间间隔
set -g status-interval 1
# 状态栏左对齐
set -g status-justify left
# 状态栏左侧宽度
set -g status-left-length 20
# 状态栏右侧宽度
set -g status-right-length 50
# 状态栏左侧显示 session 的名字
# set -g status-left '#[bg=black] [#S] #[default] ' # Solarized Dark
set -g status-left '#[bg=white] [#S] #[default] ' # Solarized Light
# 状态栏右侧显示时间
set -g status-right '#[fg=white,bg=#balck] [#h] #[fg=white,bg=#black] %Y-%m-%d #[fg=white,bg=#black] %H:%M:%S '
set -g status-style "bg=black"
# 当前激活窗口在状态栏的展位格式
setw -g window-status-current-format '#[bg=#black, fg=#00ff00, bold][#I] #W'
# 未激活每个窗口占位的格式
setw -g window-status-format '#[bg=#black, fg=#ffffff] [#I] #W '
# }
set -g default-terminal "screen-256color"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
# 这里的y复制到系统剪切板
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
set -g default-shell $SHELL
set -g default-command "reattach-to-user-namespace -l ${SHELL}"
#### COLOUR (Solarized light) {{{
# default statusbar colors
set-option -g status-bg white #base2
set-option -g status-fg yellow #yellow
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg brightyellow #base00
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg brightred #orange
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bright
# pane border
set-option -g pane-border-fg white #base2
set-option -g pane-active-border-fg brightred #base1
# message text
set-option -g message-bg white #base2
set-option -g message-fg brightred #orange
# pane number display
set-option -g display-panes-active-colour blue #blue
set-option -g display-panes-colour brightred #orange
# clock
set-window-option -g clock-mode-colour green #green
# bell
set-window-option -g window-status-bell-style fg=white,bg=red #base2, red
# }}}
#### COLOUR (Solarized dark) {{{
## default statusbar colors
#set-option -g status-bg black #base02
#set-option -g status-fg yellow #yellow
#set-option -g status-attr default
## default window title colors
#set-window-option -g window-status-fg brightblue #base0
#set-window-option -g window-status-bg default
##set-window-option -g window-status-attr dim
## active window title colors
#set-window-option -g window-status-current-fg brightred #orange
#set-window-option -g window-status-current-bg default
##set-window-option -g window-status-current-attr bright
## pane border
#set-option -g pane-border-fg black #base02
#set-option -g pane-active-border-fg brightgreen #base01
## message text
#set-option -g message-bg black #base02
#set-option -g message-fg brightred #orange
## pane number display
#set-option -g display-panes-active-colour blue #blue
#set-option -g display-panes-colour brightred #orange
## clock
#set-window-option -g clock-mode-colour green #green
## bell
#set-window-option -g window-status-bell-style fg=black,bg=red #base02, red
# }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment