-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
142 lines (120 loc) · 4.83 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
set-option -g focus-events on
# remove ESC delay
set -s escape-time 0
# preloaded sessions
bind S source-file ~/.tmux/nl
# custom term-info
# set -g default-terminal 'screen-256color'
set -g default-terminal 'tmux-256color' # from tmux.terminfo
# 256 color
# set -ga terminal-overrides ',xterm-256color:Tc'
set -ga terminal-overrides ',*:Tc'
# custom cursor shape
# set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[ q'
# custom cursor color
# set -ga terminal-overrides ',xterm*:Cr=\E]12;gray\007'
# enable italic font manually
# set -as terminal-overrides ',xterm*:sitm=\E[3m'
# scrollback buffer
set -g history-limit 10000
# set tmux to Vi mode
set-window-option -g mode-keys vi
# scroll with j/k
# bind-key -t vi-copy 'j' page-up
# bind-key -t vi-copy 'k' page-down
# remap prefix
unbind-key C-b
set-option -g prefix M-a
unbind-key M-a
bind-key M-a send-prefix
# split panes using j and l
bind L split-window -h
bind J split-window -v
unbind '"'
unbind %
# switch panes using ctrl+hjkl
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-\' select-pane -l
# resizing
bind-key -r '<' resize-pane -L 5
bind-key -r '>' resize-pane -R 5
bind-key -r '+' resize-pane -U 5
bind-key -r '_' resize-pane -D 5
# convert pane to window
# enable mouse control
# set -g mouse on
# custom window's name
set-option -g allow-rename off
# easly reload
bind-key r source-file ~/.tmux.conf \; display-message "Đảng vừa soi sáng con hàng này!"
## COLORSCHEME: gruvbox dark
# ------------------------------------------------------------------------------
# define colors
dark0="#282828"
dark1="#3c3836"
dark2="#504945"
dark3="#665c54"
dark4="#7c6f64"
gray1="#928374"
light1="#d5cfc0"
light2="#d0c2a1"
light3="#bdae93"
light4="#a89984"
red1="#cd4652"
orange1="#e79d85"
yellow1="#edaf88"
green1="#4ec9b0"
aqua1="#99d4e1"
blue1="#569cd6"
purple1="#cba0c1"
set-option -g status "on"
# default statusbar color
set-option -g status-style bg=$dark1,fg=$light3 # bg=bg1, fg=fg1
# move statusbar to the top
set-option -g status-position top
# default window title colors
set-window-option -g window-status-style bg=$yellow1,fg=$dark1 # bg=yellow, fg=bg1
# default window with an activity alert
set-window-option -g window-status-activity-style bg=$dark1,fg=$light4 # bg=bg1, fg=fg3
# active window title colors
set-window-option -g window-status-current-style bg=$red1,fg=$dark1 # fg=bg1
# pane border
set-option -g pane-active-border-style fg=$light4 #fg2
set-option -g pane-border-style fg=$dark1 #bg1
# message infos
set-option -g message-style bg=$dark2,fg=$light2 # bg=bg2, fg=fg1
# writing commands inactive
set-option -g message-command-style bg=$dark2,fg=$light3 # bg=fg3, fg=bg1
# pane number display
set-option -g display-panes-active-colour $light2 #fg2
set-option -g display-panes-colour $dark1 #bg1
# clock
set-window-option -g clock-mode-colour $blue1 #blue
# bell
set-window-option -g window-status-bell-style bg=$red1,fg=$dark0 # bg=red, fg=bg
# Theme settings mixed with colors (unfortunately, but there is no cleaner way)
set-option -g status-justify "left"
set-option -g status-left-style none
set-option -g status-left-length "80"
set-option -g status-right-style none
set-option -g status-right-length "80"
set-window-option -g window-status-separator "#[fg=$light4, bg=$dark2]"
# set status-bg default
set-option -g status-left "#[fg=$light3, bg=$dark1] #S #[fg=$dark3, bg=$dark1, nobold, noitalics, nounderscore]"
set-option -g status-right "#[fg=$dark2, bg=$dark1, nobold, nounderscore, noitalics]#[fg=$light4,bg=$dark1] %Y-%m-%d | %H:%M #[fg=$light4, bg=$dark2, nobold, noitalics, nounderscore]"
set-window-option -g window-status-current-format "#[fg=$dark1, bg=$yellow1, nobold, noitalics, nounderscore]#[fg=$dark0, bg=$light4, bold] #I#[fg=$dark0, bg=$light4, bold] #W #[fg=$yellow1, bg=$dark1, nobold, noitalics, nounderscore]"
set-window-option -g window-status-format "#[fg=$light4, bg=$dark1, noitalics]#[fg=$light4, bg=$dark1] #I#[fg=$light4, bg=$dark1] #W #[fg=$dark2, bg=$dark1, noitalics]"