-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
176 lines (142 loc) · 5.93 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
# set scrollback history to 30000 (30k)
#set -g history-limit 30000
# set Ctrl+a as the default prefix key combination
unbind C-b
set -g prefix C-a
#bind-key a last-window
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
#bind-key a send-prefix
# Start numbering at 1
set-option -g base-index 1
setw -g pane-base-index 1
# Allows for faster key repetition
# shorten command delay
#set -sg escape-time 1
# reload ~/.tmux.conf using PREFIX r
#bind r source-file ~/.tmux.conf \; display "Reloaded tmux configuration!"
# renumber windows automatically when a middle window is closed
set-option -g renumber-windows 1
# map Vim movement keys as pane movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# cycle through windows
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Change to current directory in new panes/windows
bind '%' split-window -h -c '#{pane_current_path}' # Horizontal pane
bind '"' split-window -v -c "#{pane_current_path}" # Vertical pane
bind c new-window -c '#{pane_current_path}' # New window
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=green]#H"
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize off
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Example of using a shell command in the status line
#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
# Highlight active window
#set-window-option -g window-status-current-bg blue
# Color prompt
#set -g default-terminal "screen-256color"
# ZSH shell
set-option -g default-shell "/bin/zsh"
# Mouse mode
set-option -g mouse on
# renew environment variables when reattaching
set-option -g update-environment "SSH_AUTH_SOCK \
SSH_CONNECTION \
DISPLAY"
# ---------------------
# Copy & Paste
# ---------------------
# provide access to the clipboard for pbpaste, pbcopy
#set-option -g default-command "which reattach-to-user-namespace >/dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
set-window-option -g automatic-rename on
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# use vim keybindings in copy mode
setw -g mode-keys vi
# setup 'v' to begin selection as in Vim
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# update default binding of 'Enter' to also use copy-pipe
#unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#bind y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy '
#bind C-y run 'tmux save-buffer - | reattach-to-user-namespace pbcopy '
# ----------------------
# Status Bar
# -----------------------
set-option -g status on # turn the status bar on
#set -g status-interval 5 # set update frequencey (default 15 seconds)
set -g status-justify centre # center window list for clarity
# set-option -g status-position top # position the status bar at top of screen
# visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# set color for status bar
set-option -g status-style fg=white,bg=colour235,bright
# set window list colors - red for active and cyan for inactive
set-window-option -g window-status-style fg=brightblue,bg=colour235,dim
set-window-option -g window-status-current-style fg=brightred,bg=colour236,bright
# show host name and IP address on left side of status bar
set -g status-left-length 70
set -g status-left "#[fg=brightgreen] #h : \
#[fg=brightblue]#(dig +short myip.opendns.com @208.67.222.222) :\
#[fg=brightyellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}')\
#(ifconfig eno1 | grep 'inet ' | awk '{print \"eno1 \" $2}')\
#[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "
# show session name, window & pane number, date and time on right side of
# status bar
set -g status-right-length 70
set -g status-right "#{prefix_highlight} #[fg=grey100]#S #[fg=lightsteelblue2]#I:#P \
#[fg=brightyellow]:: %d %b %Y #[fg=yellow2]::%l:%M %p\
#[fg=yellow4] :: Continuum:#{continuum_status}\
#{cpu_fg_color} ::#{cpu_percentage} #{cpu_icon}"
# Tmux child window integration
bind -n M-F11 set-option -g status-style fg=colour236,bg=colour238,dim
bind -n M-F12 set-option -g status-style fg=white,bg=colour235,bright
bind -T root F12 \
send-keys M-F12 \;\
set-option -g status-style fg=colour235,bg=colour238,dim \;\
set prefix None \;\
set key-table off \;\
bind -T off F12 \
send-keys M-F11 \;\
set-option -g status-style fg=white,bg=colour235,bright \;\
set -u prefix \;\
set -u key-table \;\
# List of plugins
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'tmux-plugins/tpm'
# Plugin specific options
## Continuum
set -g @continuum-restore 'on' # enable automatic restore on tmux server start
set -g @continuum-save-interval '15' # save session every 15 minutes
set -g @continuum-timestamp 'on' # show last session saved timestamp in the status
## Prefix highlight
set -g @prefix_highlight_fg 'black'
set -g @prefix_highlight_bg 'brightwhite'
## Resurrect
#set -g @resurrect-strategy-vim 'session'
set -g @resurrect-capture-pane-contents 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom)
run '~/.tmux/plugins/tpm/tpm'