-
-
Notifications
You must be signed in to change notification settings - Fork 160
/
.tmux.conf
153 lines (122 loc) · 4.78 KB
/
.tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# 配置 24-bit True-color(Tc), more info in this PR:
# https://github.com/tmux/tmux/pull/112
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",*256col*:Tc" # 这句是关键
# 配置使用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
set -g renumber-windows on
# 设置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
# Setup ydict
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xargs -I {} tmux run-shell -b 'ydict -q {}'"
# 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-style bg=black,fg=yellow,default
# default window title colors
set-window-option -g window-status-style fg=brightblue,bg=default,dim
# active window title colors
set-window-option -g window-status-current-style fg=brightred,bg=default,bright
# pane border
set-option -g pane-border-style fg=black
set-option -g pane-active-border-style fg=brightgreen
# message text
set-option -g message-style bg=black,fg=brightred
# 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='