-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
181 lines (138 loc) · 7.03 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
# Set $TMUX_VERSION to use in the rest of this file
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
# Added because conda on my mac wasn't working inside tmux due to the PATH vars being ordered incorrectly inside tmux
set -g default-command $SHELL
#Increase size of scrollback buffer in copy mode
set-option -g history-limit 20000
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
if-shell 'if [[ $(echo "$(tmux -V | cut -d ' ' -f2) >1.6" | bc) -eq 1 ]]; then true; else false; fi' \
'set-option -g status-position top'
set -g aggressive-resize on
#reduces lag when pressing prefix key or escape key
set -s escape-time 0
# remap prefix to ctrl + a
set -g prefix C-a
unbind C-B
# clears the scrollback buffer in addition to doing the regular bash
# Ctrl+l which moves everything off the screen
# bind -n C-l send-keys C-l \; clear-history
# C-a C-a for last active window
bind-key C-a last-window
# Status Bar Colours
set-option -g status-fg white #Status Bar fg
set-option -g status-bg black #Status Bar bg
# set-option -g status-attr default
# VERSION < 2.1
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; \
set -g message-fg red; \
set -g message-bg black; \
set -g message-attr bright; \
set -g window-status-bg black; \
set -g window-status-fg yellow; \
set -g window-status-current-attr bold; \
set -g window-status-current-fg red; \
set -g window-status-current-bg default; \
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"
# 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 -g utf8 on; set -g status-utf8 on; set -g mouse-utf8 on"
# bind-key syntax changed in 2.4 -- selection / copy / paste
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'"
# Newer versions
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' " \
bind-key -T copy-mode-vi v send -X begin-selection; \
bind-key -T copy-mode-vi V send -X select-line; \
bind-key -T copy-mode-vi C-v send -X rectangle-toggle; \
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'; \
unbind -T copy-mode-vi MouseDragEnd1Pane" # Without this, when you use the mouse to select some text, tmux exits the copy mode and scrolls all the way to the bottom
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.9" | bc)" = 1 ]' \
"set -g message-style fg=red,bg=black; \
set -g message-style bright; \
set -g window-status-style fg=default,bg=default; \
set -g window-status-current-style fg=brightred,bg=default; \
set -g window-status-bell-style fg=red,bg=black; \
set -g window-status-activity-style fg=white,bg=black"
# navigate in copy mode with vim keys
set-window-option -g mode-keys vi
# Use clipboard
# set -g set-clipboard on
# yank with y while in copy mode
# leader + P to paste anywhere
bind-key P paste-buffer
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
# is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'
# From: https://github.com/junegunn/fzf/pull/582#issuecomment-377731826
is_not_tmux="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?(g?(view|n?vim?x?)(diff)?|fzf)$'"
bind -n C-h if-shell "$is_not_tmux" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_not_tmux" "send-keys C-j" "select-pane -D" #-D normally
bind -n C-k if-shell "$is_not_tmux" "send-keys C-k" "select-pane -U" #-U normally
bind -n C-l if-shell "$is_not_tmux" "send-keys C-l" "select-pane -R"
# Go to latest pane
# (if this one doesn't work in a previous tmux version, then tr removing the extra backslash)
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" #-l normally
# CTRL + arrow keys for resizing panes
bind -n C-Left resize-pane -L 5
bind -n C-Down resize-pane -D 2
bind -n C-Up resize-pane -U 2
bind -n C-Right resize-pane -R 5
# re-bind clear screen on <prefix> c-l
bind C-l send-keys 'C-l'
# start window numbering at 1 (0 is far away on keyboard)
set -g base-index 1
# split panes using | and - (and open in the same dir as the current pane)
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# ----- STATUS CONFIGURATIONS ----- #
# Status Bar Colours
# set-option -g status-fg yellow #Status Bar fg
# set-option -g status-bg black #Status Bar bg
# set-option -g status-attr default
# set-window-option -g window-status-current-fg brightred #Active Window fg
# set-window-option -g window-status-current-bg default #Active Window bg
# default window title colors
# set-window-option -g window-status-fg brightblue #base0
# set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim
# Window Pane Border Colours
# set-option -g pane-border-fg brightgreen #Window Border
# set-option -g pane-active-border-fg brightred #Active Window Border
# set-option -g pane-active-border-bg blue #Active pane bg
# message text
#set-option -g message-bg black #base02
#set-option -g message-fg brightred #orange
# pane number display
# set-option -g display-panes-active-colour blue #blue
# set-option -g display-panes-colour brightred #orange
# clock
set-window-option -g clock-mode-colour green #green
# Adds Z indicator to tell if window is zoomed
setw -g window-status-current-format '#{?window_zoomed_flag,#[fg=red],}#F#I [#W] '
# ---------------- Tmux plugin manager --------------------------
# Follow install instructions for tpm here to be able to install the other plugins: https://github.com/tmux-plugins/tpm
# List of plugins (after you add new one, press <prefix> + shift I to intall it)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# tmux resurrect - use <prefix> + shift S to save and + shift R to restore