-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf
219 lines (175 loc) · 6.63 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
210
211
212
213
214
215
216
217
218
219
# tmux configuration
# author: gbai <guangtong.bai@gmail.com>
#
# modified: 2024/03/25
# ---------------------------------------------------------------------------
# Sections:
# 1. Base settings
# 2. Bindkeys
# 3. Color schemes
# ---------------------------------------------------------------------------
# Note:
# setw == set-window-option == set-option -w
# ---------------------------------------------------------------------------
# -------------------------------
# 1. BASE SETTINGS
# -------------------------------
# Set default shell to zsh
# --------------------------------------------------------------------------
set-option -g default-shell /bin/zsh
# Set 256 colour terminal
# --------------------------------------------------------------------------
set -g default-terminal "screen-256color"
# Longer display time (default: 750)
# --------------------------------------------------------------------------
set -g display-time 3000
# More history (default: 2000)
# --------------------------------------------------------------------------
set -g history-limit 100000
# Set base index to 1 and renumber window (default: 0)
# --------------------------------------------------------------------------
set -g base-index 1
set -g pane-base-index 1
# tmux >= 1.7
if-shell tmux_min_1.7 'set-option -g renumber-windows on'
# Aggressive Resize
# --------------------------------------------------------------------------
set-window-option -g aggressive-resize on
# Set mouse mode
# --------------------------------------------------------------------------
set -g mouse on
# for older version tmux
#set-option -g mode-mouse on
#set-option -g mouse-resize-pane on
#set-option -g mouse-select-pane on
#set-option -g mouse-select-window on
# for tmux 2.1
# Turn off monitor-activity
# --------------------------------------------------------------------------
set-window-option -g monitor-activity off
# Faster command sequences
# Removing the delay in switching Vim modes in tmux
# --------------------------------------------------------------------------
set -sg escape-time 0
# Automatically set window title
# --------------------------------------------------------------------------
set-window-option -g automatic-rename on
set-option -g set-titles on
# vi mode in tmux
set-window-option -g mode-keys vi
# -------------------------------
# 2. BINDKEYS
# -------------------------------
# Set prefix command to Ctrl-a
# --------------------------------------------------------------------------
set -g prefix C-a
unbind C-b
# Command Sequence for nested tmux session
# --------------------------------------------------------------------------
# Use C-a a <command> to send command to inner session
# --------------------------------------------------------------------------
bind a send-prefix
# Create window
# --------------------------------------------------------------------------
unbind 'c'
bind c new-window -c '#{pane_current_path}' # Creates new window
# Split window (vertical, horizontal) -> (-, |)
# --------------------------------------------------------------------------
unbind '"'
bind - splitw -v -c '#{pane_current_path}' # Split panes vertically
unbind %
bind | splitw -h -c '#{pane_current_path}' # Split panes horizontally
# Select pane (above, below, left, right) -> (k, j, h, l)
# --------------------------------------------------------------------------
# Resize pane
# --------------------------------------------------------------------------
bind -r C-k resizep -U 10
bind -r C-j resizep -D 10
bind -r C-h resizep -L 10
bind -r C-l resizep -R 10
# Swap pane
# --------------------------------------------------------------------------
bind C-u swapp -U
bind C-d swapp -D
# Refresh pane
# --------------------------------------------------------------------------
bind r respawn-pane -k
# Handle window
# --------------------------------------------------------------------------
#bind -n F1 previous-window
#bind -n F2 next-window
bind -n F9 new-window
bind -n F10 kill-window
# Select Window
# --------------------------------------------------------------------------
# <ALT> + number
#bind -n M-1 select-window -t 1
#bind -n M-2 select-window -t 2
#bind -n M-3 select-window -t 3
#bind -n M-4 select-window -t 4
#bind -n M-5 select-window -t 5
#bind -n M-6 select-window -t 6
#bind -n M-7 select-window -t 7
#bind -n M-8 select-window -t 9
#bind -n M-9 select-window -t 9
#bind -n M-0 select-window -t 10
# <Shift> + arrow
bind -n S-Left previous-window
bind -n S-Right next-window
# Select Pane
# --------------------------------------------------------------------------
# <Alt> + arrow
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# <Alt> + vim keys
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R
# Reload config
# --------------------------------------------------------------------------
# bind r source-file ~/.tmux.conf
# introducing a few Vim-only features to the vi mode
# bind-key -t vi-copy 'v' begin-selection
# bind-key -t vi-copy 'y' copy-selection
setw -g mode-keys vi
# Open new pane and execute command
# --------------------------------------------------------------------------
# man
bind m command-prompt -p man "splitw -h 'man %1 | less'"
# ssh
bind S command-prompt -p ssh: "new-window -n %1 'ssh %1'"
# htop
bind ! new-window htop
# python
bind p new-window ipython
# -------------------------------
# 3. COLOR SCHEMES
# -------------------------------
# It's leverage from wemux project
set -g status-justify centre
set -g status-interval 1
set -g status-style none
set -g status-fg white
set -g status-bg colour234
set -g status-left-length 50
set -g status-left '#[fg=colour235,bg=colour252] ❐ #S #[fg=colour245,bg=colour238] #(whoami)@#H '
set -g window-status-style none
setw -g window-status-format "#[fg=white,bg=colour234] #I #W "
setw -g window-status-current-format "#[fg=colour25,bg=colour39] #I #W "
set -g pane-border-style fg=colour245
set -g pane-active-border-style fg=colour39
set -g status-right-length 150
set -g status-right '#[fg=white,bg=colour234] [ %Y-%m-%d %H:%M ]'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'