From 8121246823ade02aa290c101c82096cebc6960bf Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Wed, 15 Feb 2023 10:43:28 -0800 Subject: [PATCH] Drop support versions of tmux older than 2.6 (latest Ubuntu LTS) --- assets/default/dotfiles/tmux.conf | 45 +++++++++---------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/assets/default/dotfiles/tmux.conf b/assets/default/dotfiles/tmux.conf index dadee09..d902563 100644 --- a/assets/default/dotfiles/tmux.conf +++ b/assets/default/dotfiles/tmux.conf @@ -32,41 +32,22 @@ bind C-j command-prompt -p "Join pane from:" "join-pane -s '%%'" bind C-s command-prompt -p "Send pane to:" "join-pane -t '%%'" bind C-b break-pane -# based on https://stackoverflow.com/a/40902312/1046584 -run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | sed 's/[^0-9.]//g')" - -# 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" +# Enable mouse mode +set -g mouse on # New keybindings for vi-mode -# https://github.com/tmux/tmux/issues/754 setw -g mode-keys vi -if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \ - 'bind -T copy-mode-vi v send-keys -X begin-selection ; \ - bind -T copy-mode-vi C-v send-keys -X rectangle-toggle ; \ - bind -T copy-mode-vi y send-keys -X copy-selection ; \ - bind -T copy-mode-vi H send-keys -X start-of-line ; \ - bind -T copy-mode-vi L send-keys -X end-of-line ; \ - bind -T choice-mode-vi h send-keys -X tree-collapse ; \ - bind -T choice-mode-vi l send-keys -X tree-expand ; \ - bind -T choice-mode-vi H send-keys -X tree-collapse-all ; \ - bind -T choice-mode-vi L send-keys -X tree-expand-all ; \ - bind -T copy-mode-emacs MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy"; \ - bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy"; ' \ - 'bind -t vi-copy v begin-selection; \ - bind -t vi-copy C-v rectangle-toggle; \ - bind -t vi-copy y copy-selection; \ - bind -t vi-choice h tree-collapse; \ - bind -t vi-choice l tree-expand; \ - bind -t vi-choice H tree-collapse-all; \ - bind -t vi-choice L tree-expand-all; \ - bind -t emacs-copy MouseDragEnd1Pane copy-pipe "pbcopy"; \ - bind -t vi-copy MouseDragEnd1Pane copy-pipe "pbcopy"; ' +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind -T copy-mode-vi y send-keys -X copy-selection +bind -T copy-mode-vi H send-keys -X start-of-line +bind -T copy-mode-vi L send-keys -X end-of-line +bind -T choice-mode-vi h send-keys -X tree-collapse +bind -T choice-mode-vi l send-keys -X tree-expand +bind -T choice-mode-vi H send-keys -X tree-collapse-all +bind -T choice-mode-vi L send-keys -X tree-expand-all +bind -T copy-mode-emacs MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy" +bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe "pbcopy" # bind p for put unbind p