From 399b55c89c63e298d7b58c10e2383bfc13feb614 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sat, 24 Apr 2021 17:41:03 +0200 Subject: [PATCH] [tmux] make some commands version agnostic. --- .tmux.conf | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 396645e..93f9e21 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -20,13 +20,16 @@ bind-key -r l select-pane -R set-window-option -g mode-keys vi # start selection with v and end with y ## tmux <= 2.3 -bind-key -t vi-copy 'v' begin-selection -bind-key -t vi-copy 'y' copy-selection -## tmux > 2.3 -# bind-key -T copy-mode-vi v send-keys -X begin-selection -# bind-key -T copy-mode-vi y send-keys -X copy-selection -# use system clipboard -bind -t vi-copy y copy-pipe "xclip -sel clip -i" +if-shell 'tmux -V | grep -Eq "tmux 2\.[0-3]"' " \ + bind-key -t vi-copy 'v' begin-selection; \ + bind-key -t vi-copy 'y' copy-selection; \ + bind -t vi-copy y copy-pipe 'xclip -sel clip -i'; \ +" + +if-shell 'tmux -V | grep -Eq "tmux 2\.[4-9]"' " \ + bind-key -T copy-mode-vi v send-keys -X begin-selection; \ + bind-key -T copy-mode-vi y send-keys -X copy-selection; \ +" # bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i' # Faster repeat time