summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-09-05 00:43:10 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-09-05 00:43:10 +0200
commit2fd0dbef60da4329fbe21242151d225bef64aabf (patch)
treee7426cf5f1c9fc3f489775cb6bda310d75990b0d
parenta435a524323e0983a84a8da50aaceb13d90b509c (diff)
downloaddotfiles-2fd0dbef60da4329fbe21242151d225bef64aabf.tar.gz
dotfiles-2fd0dbef60da4329fbe21242151d225bef64aabf.zip
add support for tmux >=2.9
-rw-r--r--tmux.conf62
1 files changed, 45 insertions, 17 deletions
diff --git a/tmux.conf b/tmux.conf
index 32b753b..87fe03a 100644
--- a/tmux.conf
+++ b/tmux.conf
@@ -2,6 +2,10 @@
# author: johannst
+# determine tmux version
+run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | awk "{print $2}" | sed "s/[^0-9.]*//g")'
+
+
### Basic Settings
# default TERM
@@ -49,15 +53,18 @@ bind-key -r C-l resize-pane -R
# Copy mode settings
set-window-option -g mode-keys vi
-if-shell "if [ $(echo \"$(tmux -V | awk '{print $2}') < 2.4\" | bc) -eq 1 ]; then true; else false; fi" \
- 'bind-key -t vi-copy v begin-selection; \
- bind-key -t vi-copy y copy-selection; \
- bind-key -t vi-copy C-a start-of-line; \
- bind-key -t vi-copy C-e end-of-line' \
- 'bind-key -T copy-mode-vi v send-key -X begin-selection; \
- bind-key -T copy-mode-vi y send-key -X copy-selection-and-cancel; \
- bind-key -T copy-mode-vi C-a send-key -X start-of-line; \
- bind-key -T copy-mode-vi C-e send-key -X end-of-line;'
+if-shell -b '[ $(echo "$TMUX_VERSION < 2.4" | bc) -eq 1 ]' {
+ bind-key -t vi-copy v begin-selection
+ bind-key -t vi-copy y copy-selection
+ bind-key -t vi-copy C-a start-of-line
+ bind-key -t vi-copy C-e end-of-line
+}
+if-shell -b '[ $(echo "$TMUX_VERSION >= 2.4"| bc) -eq 1 ]' {
+ bind-key -T copy-mode-vi v send-key -X begin-selection
+ bind-key -T copy-mode-vi y send-key -X copy-selection-and-cancel
+ bind-key -T copy-mode-vi C-a send-key -X start-of-line
+ bind-key -T copy-mode-vi C-e send-key -X end-of-line
+}
bind-key C-b choose-buffer
bind-key C-v copy-mode
bind-key C-p paste-buffer
@@ -70,20 +77,41 @@ set-option -g status-bg colour235
set-option -g status-fg colour208
# cmd line colors
-set-option -g message-bg colour235
-set-option -g message-fg colour208
+if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
+ set-option -g message-bg colour235
+ set-option -g message-fg colour208
+}
+if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
+ set-option -g message-style 'bg=colour235 fg=colour208'
+}
# non-active window title colors
-set-window-option -g window-status-fg colour244
-set-window-option -g window-status-bg default
+if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
+ set-window-option -g window-status-fg colour244
+ set-window-option -g window-status-bg default
+}
+if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
+ set-window-option -g window-status-style 'bg=default fg=colour244'
+}
# active window title colors
-set-window-option -g window-status-current-fg colour255
-set-window-option -g window-status-current-bg colour208
+if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
+ set-window-option -g window-status-current-fg colour255
+ set-window-option -g window-status-current-bg colour208
+}
+if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
+ set-window-option -g window-status-current-style 'bg=colour208 fg=colour255'
+}
# pane border
-set-option -g pane-border-fg colour235
-set-option -g pane-active-border-fg colour208
+if-shell -b '[ $(echo "$TMUX_VERSION < 2.9"| bc) -eq 1 ]' {
+ set-option -g pane-border-fg colour235
+ set-option -g pane-active-border-fg colour208
+}
+if-shell -b '[ $(echo "$TMUX_VERSION >= 2.9"| bc) -eq 1 ]' {
+ set-option -g pane-border-style 'fg=colour235'
+ set-option -g pane-active-border-style 'fg=colour208'
+}
# pane number display
set-option -g display-panes-active-colour colour208