-
Notifications
You must be signed in to change notification settings - Fork 3
/
.tmux.conf
211 lines (165 loc) · 4.62 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
#######
# REF #
#######
# References :
# - `man tmux`
# - tmux cheatsheet : https://devhints.io/tmux
# - https://github.com/majutsushi/etc/blob/master/tmux/tmux.conf
# - https://github.com/jtdaugherty/tmux-config/blob/master/tmux.conf
# - https://github.com/sbernheim4/dotfiles/blob/master/.tmux.conf
# Aliases :
# - set = set-option
# - setw = set-window-option = set -w
##############
# PREFIX-KEY #
##############
# Prefix-Key ( make it easier to press )
## Replace default `ctrl + b` with `ctrl + q`
set -g prefix C-q
unbind C-b
# Make `ctrl + a` Sendable ( to other programs )
bind C-a send-prefix
##########
# WINDOW #
##########
## New
bind c new-window -c "#{pane_current_path}"
## Split
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
########
# PANE #
########
# Select
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize
bind -r ^y resizep -L 5 # left (pf, ^h)
bind -r ^u resizep -D 5 # down (pf, ^j)
bind -r ^i resizep -U 5 # up (pf, ^k)
bind -r ^o resizep -R 5 # right (pf, ^l)
# Maximize & Minimize
unbind M
unbind m
bind M new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
bind m last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
###########
# SESSION #
###########
bind ^s kill-session
#################
# MIS-OPERATION #
#################
# Unbind Default Key-Bindings
## For avoiding mis-operations
## Switch Pane
unbind o
## Next Layout
unbind Space
####################
# CONFIG & OPTIONS #
####################
# Reload Configs
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Show Configs
## Server
bind e show-options -s
## Global
bind g show-options -g
## Ref
## - Show options : https://subscription.packtpub.com/book/hardware_and_creative/9781783985166/2/ch02lvl1sec23/show-options
##########
# COMMON #
##########
# Auto Re-number Windows ( in numerical order )
## Default : off
set -g renumber-windows on
# First Index of Windows
## Default : 0
set -g base-index 1
# First Index of Panes
## Default : 0
setw -g pane-base-index 1
# Mouse Support
## WARN: Not supported everywhere.
## It will disable `selection-copy` on iTerm,
## so I have to press ⌥ option key & select by mouse for selection-copy.
set -g mouse on
#############
# COPY-MODE #
#############
# Use VI or Emacs-style Key Bindings in Copy Mode
## Options : emacs | vi
## Default : emacs
setw -g mode-keys vi
# Select & Copy
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'u' send -X copy-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'Y' send -X copy-line
# ( Ref : https://www.grailbox.com/2020/08/use-system-clipboard-for-vi-copy-mode-in-tmux-in-macos-and-linux )
#bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
###############
# STATUS-LINE #
###############
# Position
## Options : top | bottom
## Default : bottom
set-option -g status-position bottom
# Refresh Every Interval Seconds
## Default : 15
set -g status-interval 1
# Style : Colors
##
# set -g status-style fg=black
# set -g status-style bg=green
# Left
## Default : "[#S] "
# set -g status-left " Session: #S"
set -g status-left "#[fg=black] Windows "
## Default : 10
set -g status-left-length 9
# Right
## Default : "username" hh:mm dd-MMM-YY
## e.g. : "icehe" 18:07 16-Jun-19
set -g status-right "#{prefix_highlight} "
set -ag status-right "#[fg=black]#{pane_current_path} | "
set -ag status-right "#[fg=black]%T %a %m/%d "
## Default : 40
set -g status-right-length 150
###############
# WINDOW-LIST #
###############
# Position of Window List
## Options : left | centre | right
## Default : left
# set -g status-justify left
# Control Auto Window Renaming
## Auto rename window using format specified by `automatic-rename-format`
setw -g automatic-rename on
setw -g automatic-rename-format "#{pane_current_command}"
# Format in Status Line Window List
setw -g window-status-separator ''
setw -g window-status-format " #I.#W "
setw -g window-status-current-format " #I.#W "
# Status Line Style for Windows
setw -g window-status-current-style "fg=white,bg=black"
setw -g window-status-bell-style "fg=default,bg=default"
setw -g window-status-activity-style "bg=yellow"
###########
# PLUGINS #
###########
# > It's optional.
#
# Reference:
#
# - Tmux Plugin Manager: https://github.com/tmux-plugins/tpm
# - Tmux Plugins: https://github.com/tmux-plugins
##########
# BUGFIX #
##########
# Should NOT show the control characters, e.g. backspaces!
# ( Ref: https://github.com/tmux/tmux/issues/597#issuecomment-257097101 )
set -g default-terminal "xterm-256color"