-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
182 lines (147 loc) · 5.86 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
# -- PLUGINS -------------------------------------------------------------------
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin "roy2220/easyjump.tmux"
# -- BASE16 --------------------------------------------------------------------
base00='#2e3440'
base01='#3b4252'
base02='#434c5e'
base03='#4c566a'
base04='#d8dee9'
base05='#e5e9f0'
base06='#eceff4'
base07='#8fbcbb'
base08='#88c0d0'
base09='#81a1c1'
base0A='#5e81ac'
base0B='#bf616a'
base0C='#d08770'
base0D='#ebcb8b'
base0E='#a3be8c'
base0F='#b48ead'
# -- COLORS --------------------------------------------------------------------
# set -g default-terminal "screen-256color"
set -g default-terminal 'tmux-256color'
set -ga terminal-overrides ",*256col*:Tc"
set -g display-panes-active-colour $base08
set -g display-panes-colour $base01
setw -g pane-active-border-style fg=$base09
setw -g pane-border-style fg=$base02
setw -g clock-mode-colour $base08
# -- STATUS BAR ----------------------------------------------------------------
set -g status 'on'
set -g status-left-length 30
set -g status-right-length 150
set -g status-style fg=$base02,bg=$base00,default
set -g message-style bg=$base00,fg=$base0C
# prefix config
set -g @prefix_highlight_empty_prompt ' '
set -g @prefix_highlight_empty_attr fg=$base0E,bg=$base00
set -g @prefix_highlight_prefix_prompt ''
set -g @prefix_highlight_fg $base0B
set -g @prefix_highlight_bg $base00
set -g @prefix_highlight_copy_prompt ''
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr fg=$base0D,bg=$base00
set -g @prefix_highlight_sync_prompt ''
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_mode_attr fg=$base0A,bg=$base00
setw -g window-status-style fg=$base03,bg=$base00
setw -g window-status-format " #I #W"
setw -g window-status-current-style fg=$base0D,bg=$base00
setw -g window-status-current-format " #[bold]#W"
# left status
tm_session_name="#[default,bg=$base00,fg=$base0F] #S "
set -g status-left "$tm_session_name"
# right status
tm_cpu=" #($HOME/Programming/scripts/tmux/cpu)"
tm_mem=" #($HOME/Programming/scripts/tmux/mem)"
tm_prefix="#{prefix_highlight}"
tm_zoom="#[default,bg=$base00,fg=$base0D] #{?window_zoomed_flag,,}"
tm_upTime="#[default,fg=$base09,bg=$base00] #($HOME/Programming/scripts/tmux/osx_pretty_time)"
tm_pane="#[default,bg=$base00, fg=$base0F] #P"
set -g status-right "$tm_pane $tm_upTime $tm_mem $tm_cpu $tm_zoom $tm_prefix"
# -- EASYJUMP ------------------------------------------------------------------
set -g @easyjump-key-binding "o"
# -- GENERAL -------------------------------------------------------------------
set -q -g status-utf8 on
set -g base-index 1
set -g renumber-windows on
set -g status-interval 5
set -s escape-time 20
set -g history-limit 10000
set -g display-time 4000
set -g allow-rename off
set -g repeat-time 1500
set -g set-clipboard on
set -g mouse on
set -g focus-events on
setw -q -g utf8 on
setw -g aggressive-resize on
setw -g pane-base-index 1
# -- KEYBINDS ------------------------------------------------------------------
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set -g prefix C-a
bind-key C-a send-prefix
# provide a way to clear screen after C-l is taken
bind-key C-l send-keys 'C-l'
# resize
bind-key -r H resize-pane -L 2
bind-key -r J resize-pane -D 2
bind-key -r K resize-pane -U 2
bind-key -r L resize-pane -R 2
# split panes using | and - (with same profile path)
bind-key | split-window -h -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# switch between sessions
bind-key -r ( switch-client -p
bind-key -r ) switch-client -n
bind-key P switch-client -l
# switch between synchronize all pane
bind-key e setw synchronize-panes
# throw a pane into current pane from another window
bind-key v choose-window "join-pane -v -s "%%""
bind-key h choose-window "join-pane -h -s "%%""
# kill without confirm
bind-key x kill-pane
bind-key & kill-window
# swap current pane with the selected pane
bind-key q display-panes "swap-pane -t "%%""
bind-key Q display-panes
# reload config file directly using prefix r
bind-key r source-file ~/.tmux.conf
# bmux
bind-key s display-popup -E bmux -a
# fix mouse
unbind -T root MouseDrag1Pane
unbind -T copy-mode-vi MouseDragEnd1Pane
unbind -T copy-mode-vi DoubleClick1Pane
unbind -T copy-mode-vi TripleClick1Pane
bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word
bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-no-clear
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-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 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# -- FINAL ---------------------------------------------------------------------
run -b '~/.tmux/plugins/tpm/tpm'