-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf
160 lines (128 loc) · 6.29 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
# ==================================================== Version-specific commands========================================= #
# See: https://github.com/tmux/tmux/blob/master/CHANGES
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | grep -ioP '(\\d+\\.\\d+)')"
if-shell -b '[ "$(echo "$TMUX_VERSION == 2.1" | bc)" = 1 ]' \
"set -g mouse-select-pane on; set -g mode-mouse on; \
set -g mouse-resize-pane on; set -g mouse-select-window on"
# In version 2.1 "mouse" replaced the previous 4 mouse options
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' \
"set -g mouse on"
# UTF8 is autodetected in 2.2 onwards, but errors if explicitly set
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.2" | bc)" = 1 ]' \
"set utf8 on; set -g status-utf8 on; set -g mouse-utf8 on"
# bind-key syntax changed in 2.4
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
"bind-key -t vi-copy v begin-selection \
bind-key -t vi-copy V send -X select-line \
bind-key -t vi-copy C-v rectangle-toggle \
bind-key -t vi-copy y copy-pipe 'xclip -selection clipboard -in' \
set -g message-fg red \
set -g message-bg black \
set -g message-attr bright \
set -g window-status-bg default \
set -g window-status-fg default \
set -g window-status-current-attr bold \
set -g window-status-current-bg blue \
set -g window-status-current-fg white \
set -g window-status-bell-fg red \
set -g window-status-bell-bg black \
set -g window-status-activity-fg white \
set -g window-status-activity-bg black"
# Newer versions
if-shell -b '[ "$(echo "$TMUX_VERSION > 2.4" | bc)" = 1 ]' \
"set mode-keys vi; \
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -selection clipboard -in'; \
bind-key -T copy-mode-vi C-v send -X rectangle-toggle; \
bind-key -T copy-mode-vi V send -X select-line; \
bind-key -T copy-mode-vi v send -X begin-selection;"
# Disable all *-status-* settings below if using Powerline Plugin
# if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.9" | bc)" = 1 ]' \
# =============================================== End Version Specific Commnads ======================================== #
set -g message-style fg=cyan,bg='#121212'
set -g window-status-current-style fg='#000000',bg=cyan,bold
set -g window-status-bell-style fg=red,bg=black
set -g window-status-activity-style fg=white,bg=red
set -g display-panes-colour '#333333'
set -g display-panes-active-colour white
set -g window-active-style fg='#AAAAAA',bg=#151515
set -g window-style fg='#AAAAAA',bg=#070707
set -g pane-active-border-style bg='#151515',fg=cyan
set -g pane-border-style fg='#111111'
set -g mode-style bg=cyan,fg='#121212'
set -g status-style fg='#AAAAAA',bg='#121212'
set -g clock-mode-colour green
set -gw window-status-current-format '#{?pane_synchronized,#[bg=yellow]#[fg=black],}#I:#W#F'
# Settings needed for Powerline in Tmux
# run-shell "/home/jhollis/.local/bin/powerline-daemon -q"
# Uncomment below to turn on Powerline and disable all '*-status-*' above
# source "/home/jhollis/.local/lib64/python3.6/site-packages/powerline/bindings/tmux/powerline.conf"
set -g default-terminal "tmux-256color"
# Toggle on/off status bar
bind-key -n C-Space set-option status
# Delay for showinng error message
set-option -g display-time 3000
# C-b is not acceptable -- Vim uses it
set-option -g prefix M-a
bind-key M-a last-window
bind -n C-k clear-history
#Remove default binding for split vertical and horizontal
unbind %
bind | split-window -h
bind - split-window -v
# pane movement
bind-key r command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key o command-prompt -p "send pane to:" "join-pane -t '%%'"
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Status bar layout and config
# set -g status-left ""
set -g status-right-length 150
set -g status-right "#[fg=cyan]#(whoami) #[fg=yellow]#(uname -r)#[fg=white] #(date '+%D %r') #[fg=red]#(ip -4 a | grep -i inet | grep -v 'inet 127' | grep -v 'inet 169' | head -n1 | awk '{print $2}') #[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 on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# next 2 lines are for scroll to work with tmux 2.x - Works in latest version (2.9a), but keeping here until tested with older versions of tmux
#bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
#bind -n WheelDownPane select-pane -t= \; send-keys -M
bind c command-prompt -p "Name: " "new-window -n %1"
#Paste from tmux
bind M-v run "tmux set-buffer -- \"$(xclip -o selection clipboard > /dev/null)\"; tmux paste-buffer"
#Browsing URLs
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; split-window -l 10 "$SHELL -c 'urlview < /tmp/tmux-buffer'"
# Keys to toggle monitoring activity in a window and the synchronize-panes option
bind m set monitor-activity
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'
#renumber windows when closed
set -g renumber-windows on
#make windows start at 1
set -g base-index 1
#make panes start at 1
set -g pane-base-index 1
# Resize the current pane using Alt + direction
bind -n M-k resize-pane -U 1
bind -n M-j resize-pane -D 1
bind -n M-h resize-pane -L 1
bind -n M-l resize-pane -R 1
# hjkl navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Remap zoom key to change color back to black when zoomed
# bind z resizep -Z \; if -F '#{window_zoomed_flag}' 'selectp -P bg="#000000"' 'selectp -P bg=default'
# Install TPM via git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'