-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
executable file
·192 lines (134 loc) · 5.12 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
# Basics {{{
# Default shell {{{
# take zsh if it's your shell
#set -g default-shell $SHELL
set -g default-shell /usr/local/bin/zsh
# }}}
# Centering the windows list {{{
set -g status-justify centre
# }}}
# Mouse {{{
setw -g mouse on
# }}}
# Renumber windows when one is closed {{{
set -g renumber-windows on
# }}}
# No automatic title {{{
setw -g automatic-rename off
# }}}
# Enable numbering for windows + panes {{{
set -g base-index 1 # windows start with index 1
setw -g pane-base-index 1 # panes also start with index 1
# }}}
# Response time for commands {{{
set -sg escape-time 1
# }}}
# Prefix remap to <Ctrl-a>{{{
unbind C-b # the old Prefix mapping is gone, we can use it for a new command
bind C-a send-prefix # Prefix a twice will send the command throughout tmux to other programs
set -g prefix C-a # remap of Prefix (-g says it's global to all sessions)
# }}}
# Enable vi for buffer editing {{{
setw -g mode-keys vi
# }}}
# Identifying activity in other windows {{{
setw -g monitor-activity on
set -g visual-activity on
# }}}
# Enable PageUp and PageDown keys for scrolling {{{
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
# }}}
# }}}
# Mappings {{{
# 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
# }}}
# `H,J,K,L` ... resizing panes (tmux style) {{{
# the -r options let's repeat the Prefix key only once and the defined key within a repeat time (500ms)
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# }}}
# `Prefix-S choose which tmux session you want to use {{{
bind S choose-session
# }}}
# `Prefix s, Prefix v` ... horizontal/vertical split (window splitting the Vim way) {{{
bind v split-window -h
bind s split-window -v
# }}}
# `Prefix-C-a` ... switch between two latest windows in tmux {{{
bind-key C-a last-window
# }}}
# `Prefix Space` ... go into copy mode {{{
bind Space copy-mode
# }}}
# In Copy-mode press v to start word wise selection {{{
# in tmux 2.3 bind-key -t vi-copy 'v' begin-selection
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
# }}}
# }}}
# Windows and panes styles {{{
# White text on dark background for status messages {{{
set -g status-style bg=black,fg=white
set -g window-status-activity-style bold
# }}}
# Active window is red and the other are cyan {{{
setw -g window-status-style bg=default,fg=cyan,dim
setw -g window-status-current-style bg=red,fg=white,bright
# }}}
# Tmux command and status line customizations {{{
set -g message-style bg=colour221,fg=colour16,bold
# }}}
# }}}
# Status bar {{{
# Position and elements {{{
# actual left-status: Session <number> <Windows-Index> <Pane-Index>
# actual right-status: <day> <month> <time>
set -g status-left-length 40
set -g status-left "#[fg=green]#S #[fg=yellow]#I #[fg=cyan]#P#[fg=green]"
set -g status-right "#{battery_icon} #{battery_percentage} #{battery_remain} #[fg=cyan]%d %b %R"
# }}}
# Active window is red and the other are cyan {{{
setw -g window-status-style bg=default,fg=cyan,dim
setw -g window-status-current-style bg=red,fg=white,bright
# }}}
# }}}
# tpm
# <Prefix-I> ... install tpm and all plugins
# <Prefix-U> ... update plugins
set -g @plugin 'tmux-plugins/tpm'
# common tmux settings
set -g @plugin 'tmux-plugins/tmux-sensible'
# automatic restoring and continuous saving
# `Prefix-Ctrl-s` to save session, `Prefix-Ctrl-l` load sessions
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# Last saved environment is automatically restored when tmux is started.
set -g @continuum-restore 'on'
# y ... yank the selection to clipboard, Y ... copy and paste into command line (put)
set -g @plugin 'tmux-plugins/tmux-yank'
# `Prefx u` will list URLs in extra buffer
set -g @plugin 'tmux-plugins/tmux-urlview'
# `Prefix o` in copy mode press to open pdfs, mp3, urls, files ...
set -g @plugin 'tmux-plugins/tmux-open'
# `Prefix a` start pomodoro, `Prefix A` stop a pomodoro
set -g @plugin 'swaroopch/tmux-pomodoro'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'