forked from miguelmota/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
executable file
·251 lines (205 loc) · 8.52 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
##############################
## _
## | |_ _ __ ___ _ ___ __
## | __| '_ ` _ \| | | \ \/ /
## | |_| | | | | | |_| |> <
## \__|_| |_| |_|\__,_/_/\_\
##
##############################`
# Run for changes to take effect
# tmux source-file ~/.tmux.conf
# if-shell "test -f [file]" "source ~/.tmux/tmuxlinesnapshot"
set -g prefix C-b
# Set default shell
set-option -g default-shell $SHELL
# Use vim keys
setw -g mode-keys vi
# Vim style copy and paste
unbind [
bind Escape copy-mode
#unbind p
#bind p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
#bind-key -T copy-mode-vi 'y' copy-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe 'reattach-to-user-namespace pbcopy'
#bind-key -T copy-mode 'y' send -X copy-pipe-and-cancel 'pbcopy'
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe 'reattach-to-user-namespace pbcopy'
#bind-key -T copy-mode Enter send -X copy-pipe-and-cancel 'pbcopy'
# Point and click to enter panel and also resize with mouse
#set -g mouse-utf8 on
# Scroll pane with mouse
set -g mouse on
# Renumber windows after closing
set-option -g renumber-windows on
# Window numbering starts at 1
set -g base-index 1
set-window-option -g pane-base-index 1
# Resize windows to smallest client only when active
setw -g aggressive-resize on
# Send command to nested tmux with C-b b
bind-key b send-prefix
# Last window with C-b C-b
bind-key C-b last-window
set-option -gw xterm-keys on
# Easier window switching M = Alt
#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
# 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"
#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
# Move around panes with j and k, a bit like vim
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes like vim, -r = repeatable
unbind-key -n p
bind-key -nr C-h resize-pane -L
bind-key -nr C-j resize-pane -D
bind-key -nr C-k resize-pane -U
bind-key -nr C-l resize-pane -R
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Keep current directory when creating new pane or window
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Scroll amount limit lines
set -g history-limit 10000
# Visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# Use 256 colors
set-option -g default-terminal 'screen-256color'
#### THEME CONFIG ####
# Statusbar colors
#set-option -g status-bg black
#set-option -g status-fg green
#set-option -g status-style default
# worked on tmux 2.9
set-option -g status-style "bg=default,fg=green"
# Window title colors
set-window-option -g window-status-style "fg=green,bg=default,dim"
# Active window title colors
set-window-option -g window-status-current-style "fg=default,bg=yellow,bright"
# Window with activity indictator
set-window-option -g window-status-activity-style "fg=green,bg=default,bright"
# Pane border colors
# gray: colour235
# green: colour28
set-option -g pane-border-style fg=white
set-option -g pane-active-border-style fg=white
# Message text colors (light-black: colour235)
set-option -g message-style bg=default
set-option -g message-style fg=colour196
# Pane number display color (leader+q)
set-option -g display-panes-active-colour colour20
set-option -g display-panes-colour colour196
# Clock color
set-window-option -g clock-mode-colour colour40
# Status bar options
set-option -g status on
#set -g status-utf8 on # (not supported)
set -g status-interval 2 # set update frequency in seconds
set -g status-justify left # left align window list
# Status region size
set -g status-left-length 100
set -g status-right-length 120
#### END THEME CONFIG ####
# Show host name and IP address
#set -g status-left "#[fg=cyan]: #h : #[fg=green]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}')"
# Show session name, window and pane number, date and time
#set -g status-right "#[fg=yellow]#S #I:#P : #[fg=green]#(w | head -n1 | cut -d":" -f4) : #[fg=magenta]#(~/.bin/battery Discharging; ~/.bin/battery Charging): #[fg=cyan] %d %b %Y %l:%M %p :"
# Use powerline
# source ~/.powerline/powerline/bindings/tmux/powerline.conf
# set -g status-left '#(powerline-render tmux left)'
# set -g status-right '#(powerline-render tmux right)'
# ENABLE ON MAC ONLY: Copy and paste support (brew install reattach-to-user-namespace)
#set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# ENABLE ON LINUX ONLY
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# https://github.com/tmux-plugins/tmux-sensible/issues/42
set-option -g default-command "$SHELL"
# Fixes ESC delay in vim
set -sg escape-time 0
# Show continuum status for debugging
# set -g status-right 'Continuum: #{continuum_status}'
# Requires power symbols if using powerline: https://unicodepowersymbol.com/font/
set-option -g status-left '#H [#S:#P] '
# Date format
# %a %h %d - Sun Jan 12
# %Y-%m-%d - 2020-01-12
set -g status-right "#{prefix_highlight} #{online_status} #(curl icanhazip.com) #(ifconfig en0 | grep 'inet ' | awk '{print \"en0:\" $2}') #($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --averages-count 0 --interval 2) #{battery_status_fg}[#{battery_percentage}]#[fg=default] %Y-%m-%d %H:%M:%S "
# List of plugins
# Supports `github_username/repo` or full git repo URLs
# set -g @plugin 'git@bitbucket.com/user/plugin'
# use `prefix + I` to install plugins to `~/.tmux/plugins/`
# use `prefix + U` to update plugins
# NOTE: if plugins not installing, try deleting the folders in ~/.tmux/plugins
set -g focus-events on
# tmux package manager
set -g @plugin 'tmux-plugins/tpm'
# basic tmux settings
# set -g @plugin 'tmux-plugins/tmux-sensible'
# Save and restore session
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Autosave session
set -g @plugin 'tmux-plugins/tmux-continuum'
# Better search features
set -g @plugin 'tmux-plugins/tmux-copycat'
# Press "prefix + u" to list urls (requires `brew install urlview`)
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @urlview-key 'u'
# open highlighted url with "o"
set -g @plugin 'tmux-plugins/tmux-open'
# Copy to system clipboard
set -g @plugin 'tmux-plugins/tmux-yank'
# Show prefix key is on in statusbar
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Show online status
set -g @plugin 'tmux-plugins/tmux-online-status'
# Show battery status
set -g @plugin 'tmux-plugins/tmux-battery'
# Show CPU status
# set -g @plugin 'tmux-plugins/tmux-cpu'
# Show CPU, memory, and load average status
#set -g @plugin 'thewtex/tmux-mem-cpu-load'
# Toggle tree sidebar with "prefix + tab"
# set -g @plugin 'tmux-plugins/tmux-sidebar'
# Wrapper for facebook pathpicker
# set -g @plugin 'tmux-plugins/tmux-fpp'
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes 'vi vim nvim emacs man less more tail top htop watch irssi ssh psql mysql sqlite3'
set -g @resurrect-strategy-vim 'session'
# autosave session every minute
set -g @continuum-save-interval '1'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm'
set -g @continuum-restore 'on'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=yellow,bg=default'
set -g @prefix_highlight_fg 'colour235'
set -g @prefix_highlight_bg 'default'
set -g @prefix_highlight_prefix_prompt 'TMUX'
set -g @prefix_highlight_copy_prompt 'COPY'
set -g @prefix_highlight_output_prefix '['
set -g @prefix_highlight_output_suffix ']'
set -g @online_icon '#[fg=green]✓#[fg=default]'
set -g @offline_icon '#[fg=red]✗#[fg=default]'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'