-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
211 lines (158 loc) · 7.7 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# _
# _ __ ___ _ _| |_ _ __ ___ _ ___ __
# | '_ ` _ \| | | | __| '_ ` _ \| | | \ \/ /
# | | | | | | |_| | |_| | | | | | |_| |> <
# |_| |_| |_|\__, |\__|_| |_| |_|\__,_/_/\_\
# |___/
#
# tmux is a terminal multiplexer
# -- general -------------------------------------------------------------------
#set -g default-terminal 'xterm-256color'
set -g default-terminal "screen-256color"
set -gas terminal-overrides ',xterm*:RGB:sitm=\E[3m'
set -gas terminal-overrides ',xterm*:Tc'
setw -g xterm-keys on
set -s escape-time 0
set -sg repeat-time 300
set -s focus-events on
set -g mouse on
set -sg exit-empty on
set -g visual-activity off
setw -g monitor-activity off
setw -g monitor-bell off
set -g history-limit 20000
# -- basic key map ------------------------------------------------------------
set -g prefix2 C-x # GNU-Screen compatible prefix
bind C-x send-prefix -2
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
# edit configuration
bind e new-window -n "~/.tmux.conf" "sh -c '\${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"*/.tmux.conf sourced\"'"
# reload configuration
bind r source-file ~/.tmux.conf \; display '*/.tmux.conf sourced'
# -- toggle_status
bind s if-shell '[[ $(tmux show -g status | cut -d\ -f2) == "on" ]]' \
'set -g status off' \
'set -g status on'
# -- app ------------------------------
# htop (prefix !)
bind ! splitw htop
bind @ splitw ranger
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 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 display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
set -g status-interval 10 # redraw status line every 10 seconds
# clear both screen and history
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
# activity
set -g monitor-activity on
set -g visual-activity off
# pane border
#set-option -g pane-border-style fg=colour235 #fg=base02
#set-option -g pane-active-border-style fg=colour240 #fg=base01
# -- navigation ----------------------------------------------------------------
# $:重命名当前会话
# 启动命名tmux tmux new -s <name>
# 分离会话 tmux detach
# 重接会话 tmux attach -t <name>
# 杀死会话 tmux kill-session -t <name>
# 切换会话 tmux switch -t <name>
# 列出所有快捷键,及其对应的 Tmux 命令 tmux list-keys
# 列出所有 Tmux 命令及其参数 tmux list-commands
# 列出当前所有 Tmux 会话的信息 tmux info
# create session
bind C-c new-session
# find session
bind C-f command-prompt -p "find session:" {switch-client -t '%%'}
# kill seesion
bind C-d command-prompt -p "kill session:" {kill-session -t '%%'}
# split current window horizontally
bind = split-window -v
# split current window vertically
bind - split-window -h
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# q 显示窗格的编号(和尺寸),此时可通过按下数字切换(使用后面的主题后数字切换失效)
# o:交换窗格(将输入切换到下一个窗格)
# maximize current pane
bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D'
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# window navigation
# c:新建窗口
# 0~9 选择几号窗口
# w:列出所有窗口,此时可通过方向键和回车键切换
# n:切换到后一个窗口(使用后面的主题后失效)
# p:切换到前一个窗口(使用后面的主题后失效)
# ,:重命名当前窗口(不知是否可以在创建时就命名)
# &:关闭当前窗口。
bind Tab last-window # move to last active window
# toggle mouse
bind m run "cut -c3- ~/.tmux.conf | sh -s _toggle_mouse"
# -- list choice (tmux < 2.4) --------------------------------------------------
# vi-choice is gone in tmux >= 2.4
#run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true'
#run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true'
#run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true'
#run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true'
#run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true'
#run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true'
#run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true'
# -- edit mode (tmux < 2.4) ----------------------------------------------------
# vi-edit is gone in tmux >= 2.4
#run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true'
#run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true'
#run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true'
#run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true'
# -- copy mode -----------------------------------------------------------------
#bind Enter copy-mode # enter copy mode
#run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
#run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
#run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
#run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
#run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
#run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
#run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
#run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
#run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
#run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
#run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
#run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'??,
# panes
#setw -g pane-border-status bottom
setw -g pane-border-format '#[bold]#{?#{&&:#{pane_active},#{client_prefix}},#[underscore],}\
#{?pane_active,❐ #S:#I/#{session_windows} ,}#{?window_zoomed_flag,⬢,❄} #P ⇒ #{pane_tty} #{pane_current_command}'
#set -g pane-active-border-style fg=brightblue
#set -g pane-border-style fg=magenta
# windows
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
setw -g window-status-separator ''
# default statusbar colors
set -g status-bg black
setw -g window-status-format '#[fg=brightblue] #I #W '
setw -g window-status-current-format '#[fg=magenta,bold] #I #W:#F'
setw -g window-status-activity-style bg=black
setw -g window-status-bell-style bg=black
#set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]⮀#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour235]⮀"
set-option -g status-left "#(~/.config/tmux/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/.config/tmux/tmux-powerline/powerline.sh right)"
#run-shell ~/.config/tmux/extrakto/extrakto.tmux
#run-shell ~/.config/tmux/for-mac.sh
#set-option default-path "$PWD"