Skip to content

Instantly share code, notes, and snippets.

@TimothyYe
Created June 19, 2014 15:17
Show Gist options
  • Save TimothyYe/7341a9f55c99a0521a8f to your computer and use it in GitHub Desktop.
Save TimothyYe/7341a9f55c99a0521a8f to your computer and use it in GitHub Desktop.
tmux config
# 配置使用和GNU Screen相同的C-a作为命令引导键
set -g prefix C-a
# 设置终端类型为256色
set -g default-terminal "screen-256color"
# 设置状态栏前景及背景色
set -g status-bg colour23
set -g status-fg colour238
# 设置窗口标签的前景及背景色
setw -g window-status-fg colour232
setw -g window-status-bg default
setw -g window-status-attr dim
# 设置当前窗口标签的前景及背景色
setw -g window-status-current-fg colour88
setw -g window-status-current-bg colour130
setw -g window-status-current-attr bright
# 设置窗口分割的边框颜色
set -g pane-border-fg colour189
set -g pane-border-bg black
# 设置当前窗口分割的边框颜色
set -g pane-active-border-fg white
set -g pane-active-border-bg colour208
# 设置提示信息的前景及背景色
set -g message-fg colour232
set -g message-bg colour23
set -g message-attr bright
# 设置状态栏左部宽度
set -g status-left-length 40
# 设置状态栏显示内容和内容颜色。这里配置从左边开始显示,使用绿色显示session名称,黄色显示窗口号,蓝色显示窗口分割号
set -g status-left "#[fg=colour52]#S #[fg=yellow]#I #[fg=cyan]#P"
# 设置状态栏右部宽度
set -g status-right-length 80
# 设置状态栏右边内容,这里设置为时间信息
set -g status-right "#[fg=colour106]#(~/bin/system_info.sh) #[fg=colour208]|%d %b %R"
# 窗口信息居中显示
set -g status-justify centre
# 监视窗口信息,如有内容变动,进行提示
setw -g monitor-activity on
set -g visual-activity on
set -g status-utf8 on
# 窗口号和窗口分割号都以1开始(默认从0开始)
set -g base-index 1
setw -g pane-base-index 1
# 支持鼠标选择窗口,调节窗口大小
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
set -s escape-time 1
# 设置C-a a为发送C-a键
bind a send-prefix
# 加载tmux配置文件的快捷键
bind r source-file ~/.tmux.conf\; display "Reloaded!"
# 快捷键查看man
bind / command-prompt "split-window 'exec man %%'"
unbind "%"
unbind "\""
# 修改默认的窗口分割快捷键,使用更直观的符号
bind | split-window -h
bind - split-window -v
# 选择窗口功能修改为和Screen一样的C-a "
bind "\"" choose-window
# 选择窗口分割快捷键
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# 选择窗口快捷键
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# 调节窗口大小快捷键
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
# 快捷调整窗口分割到全屏
unbind Up
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# 快捷记录窗口内的内容到文件中
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment