-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
185 lines (150 loc) · 8.24 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
# -------------------------------------------------------------------------------------------------
# General Settting
# -------------------------------------------------------------------------------------------------
# unbind all binded keys before setting
# unbind-key -a
##########################
# According to source code github:tmux/tmux/cmd-set-option.c
# set -g alias to set-option -g
# setw -g alias to set-window-option -g
##########################
# 24-biti colors
set -g default-terminal screen-256color
set-option -ga terminal-overrides ",*256col*:Tc"
# copy paste mode - vi
setw -g mode-keys vi
set-option -g status-keys vi
# Other config
set-option -g mouse off
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Prevent Applications Like Vim and Less Clearing Screen on Exit
set-window-option -g alternate-screen off
# history in tmux
set-option -g history-limit 100000
# tmux will automatically renumber the windows of a session (as with move-window -r) after any window is closed
set-option -g renumber-windows on
# helps in faster key repetition, useful for switching mode between ESC and i in vim
# if cares about ESC and i switching in vim, set to 50 is recommended
# , set to zero is not recommended, it might effect Function key in tmux (F1~F12)
# it would be better NOT to change this value, use default value: 500
#set-option -sg escape-time 500
# works with window-status-activity-style
setw -g monitor-activity on
set -g allow-rename off # default setting
# Refresh status-bar , every (n) seconds
set -g status-interval 1 # Default : 1
# -------------------------------------------------------------------------------------------------
# bind-key Settting
# -------------------------------------------------------------------------------------------------
##########################
# -T, table <prefix|root>
# default -T prefix
# EX: bind-key -T prefix c new-window ===> bind-key c new-window
# -r, repeat , used with prefix
# -n , used without prefix
# EX: -T root ===> -T root -r (because without prefix, keyboard could repeat key in automatically)
# EX: bind-key -n F8 next-window
##########################
# ----- prefix setup -----
#Set prefix key to Ctrl-a
unbind-key C-b
set-option -g prefix C-a
# send the prefix to client inside window
bind-key C-a send-prefix
# ----- bind-key : pane -----
# ** pane **
bind-key -n F1 break-pane # move current pane to new-window
bind-key -n F2 split-window -v -c '#{pane_current_path}'
bind-key -n F3 split-window -h -c '#{pane_current_path}'
bind-key -n F4 resize-pane -Z # Maxmize pane
#bind-key -n S-F2 select-layout -E
#bind-key -n S-F3 next-layout
#bind-key -n S-F4 break-pane # move current pane to new-window
bind-key -n F9 last-window
#bind-key -n S-F9 select-pane -t :.+ # Jump to pane, could use alt+arrow instead
#bind-key -n S-F9 rotate-window
# ** pane selection **
bind-key -n M-Up select-pane -U
bind-key -n M-Down select-pane -D
bind-key -n M-Left select-pane -L
bind-key -n M-Right select-pane -R
# ** pane - resize **
unbind-key M-Up
unbind-key M-Down
unbind-key M-Left
unbind-key M-Right
bind-key -r M-Up resize-pane -U 2
bind-key -r M-Down resize-pane -D 2
bind-key -r M-Left resize-pane -L 2
bind-key -r M-Right resize-pane -R 2
# ----- bind-key : window -----
# new-window -a , -a mean create new window next to current window
#bind-key -n F5 new-window -a # <--- reorder(renumber-windows) window number will solve my issue
bind-key -n F5 new-window
bind-key -n F6 detach
bind-key -n F7 previous-window
bind-key -n F8 next-window
# select window by specifying ALT + number
bind-key -n M-1 select-window -t :=1
bind-key -n M-2 select-window -t :=2
bind-key -n M-3 select-window -t :=3
bind-key -n M-4 select-window -t :=4
bind-key -n M-5 select-window -t :=5
bind-key -n M-6 select-window -t :=6
bind-key -n M-7 select-window -t :=7
bind-key -n M-8 select-window -t :=8
bind-key -n M-9 select-window -t :=9
# move current window to left / right
#bind-key -n S-Left swap-window -d -t -1
#bind-key -n S-Right swap-window -d -t +1
bind-key -n M-z swap-window -d -t -1
bind-key -n M-x swap-window -d -t +1
# --- bind-key : helper ---
bind-key [ copy-mode
bind-key ] paste-buffer
bind-key : command-prompt
bind-key ? list-keys
# -------------------------------------------------------------------------------------------------
# TMUX Plugins
# -------------------------------------------------------------------------------------------------
# --- Basic plugins ---
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# delete plugin folders which is not used anymore (plugin listed before, but removed from .tmux.conf already)
bind-key C run-shell ~/.tmux/plugins/tpm/bindings/clean_plugins
# --- charlietag : theme ---
set -g @plugin 'charlietag/tmux-themes'
set -g @theme-loading-cpu-mem 'on' # [ on | off] , default: on
set -g @theme-network-bandwith 'on' # [ on | off] , default: on
set -g @theme-dark-mode 'on' # [ on | off] , default off
set -g @theme-dard-mode-bindkey 'T' # [ -r T | M-s | -n F11 ] , this is for toggle theme dark mode, define yourself just like bind-key
#--- tmux copy cat (like vim-easymotion) ---
set -g @plugin 'tmux-plugins/tmux-copycat'
# # --- Recover session after reboot ---
# # tmux session save / restore
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @resurrect-strategy-vim 'session' # recover vim session
# set -g @resurrect-capture-pane-contents 'on' # recover pane layout and contents
#
# # auto save session ,auto restore session , works with tmux-resurrect
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @continuum-save-interval '15' # auto save every N minutes (default: 15)
# #set -g @continuum-restore 'on' # auto restore after tmux kill-server, comment this out to disable this feature
# --- charlietag : Plugins ---
# get cpu model name , automatically **append** cpu model into "status-left" or "status-right"
set -g @plugin 'charlietag/tmux-cpu-model' # limitation : this line must behind theme / status-format (either plugin way or directly setup above)
set -g @cpu-model-mode 'left' # [ left | right | none ]
set -g @cpu-model-info 'simple' # [ simple | detail ]
set -g @cpu-model-colour 'fg=colour232,bg=colour252,bold' # setup cpu model name style
set -g @cpu-model-colour-dark-mode 'on' # [ on | off] , default off
set -g @cpu-model-colour-dark 'fg=colour252,bg=black,bold' # setup cpu model name style (DARK MODE)
# split status bar into two parts : window + status-left/status-right, requires tmux version ~> 3.0
set -g @plugin 'charlietag/tmux-split-statusbar' # limitation : this line must behind theme / status-left / status-right (either plugin way or directly setup above)
set -g @split-statusbar-mode 'on' # [ on | off]
#set -g @split-statusbar-bindkey '-n F11' # [ M-s | -n F11 ] , this is for toggle statusbar-mode, define yourself just like bind-key
set -g @split-statusbar-bindkey 'S' # [ M-s | -n F11 ] , this is for toggle statusbar-mode, define yourself just like bind-key
#set -g @split-status-hide-bindkey '-n F12' # [ M-s | -n F12 ] , this is the toggle for status-left / status-right hiding, define yourself just like bind-key
set -g @split-status-hide-bindkey 'H' # [ M-s | -n F12 ] , this is the toggle for status-left / status-right hiding, define yourself just like bind-key
# --- Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) ---
run -b '~/.tmux/plugins/tpm/tpm'