Permalink
Switch branches/tags
Nothing to show
Find file Copy path
07c8bb5 Aug 27, 2018
2 contributors

Users who have contributed to this file

@TimothyYe @sfwn
156 lines (126 sloc) 4.85 KB
# 配置 24-bit True-color(Tc), more info in this PR:
# https://github.com/tmux/tmux/pull/112
set -ga terminal-overrides ',*:Tc'
set -g default-terminal "screen-256color"
# 配置使用ctrl+g作为命令引导键(默认为ctrl+a)
set -g prefix C-g
# Set default shell to zsh
set-option -g default-shell /bin/zsh
#
# 设置窗口分割的边框颜色
# 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
#
# this option is only available in tmux 2.1+
if-shell '[[ `tmux -V | cut -d" " -f2` == 2.1 ]] || [[ `tmux -V | cut -d" " -f2` > 2.1 ]]' \
"set-window-option -g mouse on"
# 设置状态栏左部宽度
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 'CPU:#{cpu_percentage} | Battery: #{battery_icon} #{battery_percentage} #{battery_remain} | %a %h-%d %H:%M '
# 窗口信息居中显示
set -g status-justify centre
# 监视窗口信息,如有内容变动,进行提示
setw -g monitor-activity on
set -g visual-activity on
# 窗口号和窗口分割号都以1开始(默认从0开始)
set -g base-index 1
setw -g pane-base-index 1
# 支持鼠标选择窗口,调节窗口大小
set -g mouse 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 3
bind -r J resize-pane -D 3
bind -r K resize-pane -U 3
bind -r L resize-pane -R 3
# 快捷记录窗口内的内容到文件中
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# Make sure you have the "Applications in terminal may access clipboard" option set when using iTerm2
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
# List olugins
# # Supports `github_username/repo` or full git repo URLs
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-cpu'
# Other examples:
# github_username/plugin_name \
# git@github.com/user/plugin \
# git@bitbucket.com/user/plugin \
# Initializes TMUlugin manager.
# Keep this line at the very bottom of tmux.conf.
run '~/.tmux/plugins/tpm/tpm'
#### 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
run-shell ~/.tmux/plugins/tmux-battery/battery.tmux
run-shell ~/.tmux/plugins/tmux-cpu/cpu.tmux
run-shell ~/.tmux/plugins/tmux-urlview/urlview.tmux
run-shell ~/.tmux/plugins/tmux-open/open.tmux
# 快捷调整窗口分割到全屏
unbind u
bind u new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
unbind n
bind n last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
set -g @urlview-key 'i'
set -g @open-S 'https://www.google.com/search?q='