forked from liuchengxu/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
162 lines (128 loc) · 6.97 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
154
155
156
157
158
159
160
161
162
# Enable italic font in iterm2
# Refer to http://apple.stackexchange.com/questions/249307/tic-doesnt-read-from-stdin-and-segfaults-when-adding-terminfo-to-support-italic/249385
# set -g default-terminal "tmux-256color"
# invoke reattach-to-user-namespace every time a new window/pane opens
# if-shell doesn't always work
if-shell '[ $(uname -s) = Darwin ]' \
'set -g default-terminal "xterm-256color"; set -g default-command bash'
# Sierra remove reattach-to-user-namespace
# 'set -g default-terminal "tmux-256color"; set -g default-command "reattach-to-user-namespace -l bash"'
# 设置终端类型为256色
if-shell '[ $(uname -s) = Linux ]' \
'set -g default-terminal "screen-256color"'
set -g history-limit 102400
# Add truecolor support
set-option -ga terminal-overrides ",*256col*:Tc"
# set -as terminal-overrides ',xterm*:sitm=\E[3m'
# 开启剪切板
set -g set-clipboard on
# 关闭窗口后重新编号
set -g renumber-windows on
# Index starts from 1
set-option -g base-index 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g set-titles-string '#h ❐ #S ● #I #W'
# 事件窗口信息,如有内容变动,进行提示
setw -g monitor-activity on
set -g visual-activity on
# set -g status-utf8 on # 在状态栏开启UTF-8
set -g history-limit 102400 # scrollback buffer n lines
set -g mode-keys vi # user vi mode
set -g repeat-time 0
# 支持鼠标选择窗口,调节窗口大小
#setw -g mode-mouse on
#set -g mouse-select-pane on
#set -g mouse-resize-pane on
#set -g mouse-select-window on
# 设置重新连接不同窗口大小的tmux
setw -g aggressive-resize on
# select-pane (@george-b)
bind-key 0 run "tmux split-window -p 40 'bash -ci ftpane'"
# set -g default-shell /bin/zsh
# 重新绑定纵向和横向切分window快捷键。|,-,更直观地表明了切割方向
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# 在不同面板间切换,改为vim风格
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
# 设置前缀键,默认为Ctrl+b
# set -g prefix C-b
# 释放之前的Ctrl-b前缀快捷键
# unbind C-b
#jtmux有一个延时以方便用户按键组合,默认有点长。这里设置为1秒钟
set -s escape-time 1
# 设置动态加载tmux配置文件的快捷键
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded"
# 设置窗口标签的前景及背景色
# setw -g window-status-fg colour72
# setw -g window-status-bg colour238
# junegunn
set-window-option -g window-status-format '#[bg=colour238]#[fg=colour107] #I #[bg=colour239]#[fg=colour110] #[bg=colour240]#W#[bg=colour239]#[fg=colour195]#F#[bg=colour238] '
set-window-option -g window-status-current-format '#[bg=colour236]#[fg=colour215,bold] #I:#[bg=colour235]#[fg=colour167] #[bg=colour234]#W#[bg=colour235]#[fg=colour195]#F#[bg=colour236] '
setw -g window-status-attr dim
# 设置当前窗口标签的前景及背景色,所谓当前窗口标签会显示在状态栏中间
# setw -g window-status-current-fg colour22
# setw -g window-status-current-bg colour73
# setw -g window-status-current-attr bright
# 设置窗口分割的边框颜色
# set -g pane-border-fg yellow
set -g pane-border-fg colour237
# set -g pane-border-bg black
# 设置当前窗口分割的边框颜色
# set -g pane-active-border-fg green
set -g pane-active-border-fg colour240
# set -g pane-active-border-bg yellow
# 设置提示信息的前景及背景色, e.g, Reload
set -g message-fg colour168
set -g message-bg colour237
set -g message-attr bright
#set -g set-titles-string '#T'
################### 状态栏设置 ###############################
# 以下色彩为mac环境下,Linux下可能需重新设置颜色
# 设置状态栏前景色,背景色
#set -g status-fg white
#set -g status-bg black
# 设置状态栏前景及背景色
set -g status-bg colour237
set -g status-fg colour68
# 设置状态栏左部宽度 默认为10
set -g status-left-length 45
# 设置状态栏左部显示内容。
# https://gitlab.com/gnachman/iterm2/issues/6666
# set -g status-left "#[fg=colour252,bold,bg=colour243] 🌺 S: #S #[fg=colour250,bg=colour239] 🏵 W: #I #[fg=yellow,bg=colour237] ☘ #[fg=colour250,bg=colour237] P: #P#[default]"
# set-option -g status-left '#[bg=colour72] #[bg=colour234] #[bg=colour235] #[bg=colour236]#[fg=colour185,bg=colour238] 🌺 S:#S #[fg=colour251,bg=colour239] 💻 #h '
# set-option -g status-left '#[bg=colour72] #[bg=colour236] #[bg=colour237]#[fg=colour185,bg=colour238] 🌺 S:#S #[fg=colour251,bg=colour239] 💻 #h '
set-option -g status-left '#[bg=colour72] #[bg=colour236] #[bg=colour237]#[fg=colour185,bg=colour238] S:#S #[fg=colour251,bg=colour239] h:#h '
# 设置状态栏右部宽度
set -g status-right-length 48
# 设置状态栏右部内容,这里设置为时间信息
# macOS
# set -g status-right "#[fg=colour251,bg=colour239] 🗓 %b-%d #[fg=colour251,bg=colour238] ⏱ %R #[fg=colour251,bg=colour237] 🐳 #(ifconfig | grep 'inet.*netmask.*broadcast' | awk '{print $2}') #[bg=colour236] #[bg=colour235] #[bg=colour72] "
set -g status-right "#[fg=colour251,bg=colour239]%b-%d #[fg=colour251,bg=colour238] %R #[fg=colour251,bg=colour237] #(ifconfig | grep 'inet.*netmask.*broadcast' | awk '{print $2}') #[bg=colour236] #[bg=colour235] #[bg=colour72] "
set -g status-right "#[fg=colour251,bg=colour239]%b-%d #[fg=colour251,bg=colour238] %R #[fg=colour251,bg=colour237] #(ifconfig | grep 'inet.*netmask.*broadcast' | awk '{print $2}') #[bg=colour236] #[bg=colour235] #[bg=colour72] "
set-option -g status-left "#[fg=colour248, bg=colour241] S:#S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, bg=colour248] #(ifconfig | grep 'inet.*netmask.*broadcast' | awk '{print $2}') "
# Ubuntu
# set -g status-right "#[fg=colour251,bg=colour239] 🗓 %b-%d #[fg=colour251,bg=colour238] ⏱ %R #[fg=colour251,bg=colour237] 🐳 #(ifconfig | grep 'inet addr:192' | cut -d: -f2 | awk '{print $1}') #[bg=colour236] #[bg=colour72] "
# 窗口信息居中显示
set -g status-justify centre
# 设置状态栏更新时间 每60秒更新一次,默认是15秒更新
set -g status-interval 60
# https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux
set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
# Move status bar to the top
# set-option -g status-position top
set-option -g status-position bottom