From b0c3b6a09feac2aca6be5a211597ce0fbd4f21e4 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 5 Dec 2016 22:31:31 +0100 Subject: [PATCH] tmux 2.4 got rid of mode keys. Closes #42 - vi-copy is replaced by a normal copy-mode-vi key table - vi-edit and vi-choice are gone --- .tmux.conf | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index def2373..dc79176 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -11,7 +11,6 @@ set -g default-terminal "screen-256color" # colors! setw -g xterm-keys on set -s escape-time 10 # faster command sequences set -sg repeat-time 600 # increase repeat timeout -set -s quiet on # disable various messages set -s focus-events on set -g prefix2 C-a # GNU-Screen compatible prefix @@ -93,25 +92,25 @@ bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}" bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}" -# -- list choice --------------------------------------------------------------- +# -- list choice (tmux < 2.4) -------------------------------------------------- -bind -t vi-choice h tree-collapse -bind -t vi-choice l tree-expand -run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null' -run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null' -bind -t vi-choice H tree-collapse-all -bind -t vi-choice L tree-expand-all -bind -t vi-choice Escape cancel +# vi-choice is gone in tmux >= 2.4 +run -b 'tmux bind -t vi-choice h tree-collapse 2> /dev/null || true' +run -b 'tmux bind -t vi-choice l tree-expand 2> /dev/null || true' +run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null || true' +run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null || true' +run -b 'tmux bind -t vi-choice H tree-collapse-all 2> /dev/null || true' +run -b 'tmux bind -t vi-choice L tree-expand-all 2> /dev/null || true' +run -b 'tmux bind -t vi-choice Escape cancel 2> /dev/null || true' -# -- edit mode ----------------------------------------------------------------- +# -- edit mode (tmux < 2.4) ---------------------------------------------------- -# the following vi-copy bindings match my vim settings -# see https://github.com/gpakosz/.vim.git -bind -ct vi-edit H start-of-line -bind -ct vi-edit L end-of-line -bind -ct vi-edit q cancel -bind -ct vi-edit Escape cancel +# vi-edit is gone in tmux >= 2.4 +run -b 'tmux bind -ct vi-edit H start-of-line 2> /dev/null || true' +run -b 'tmux bind -ct vi-edit L end-of-line 2> /dev/null || true' +run -b 'tmux bind -ct vi-edit q cancel 2> /dev/null || true' +run -b 'tmux bind -ct vi-edit Escape cancel 2> /dev/null || true' # -- copy mode ----------------------------------------------------------------- @@ -121,14 +120,16 @@ bind b list-buffers # list paster buffers bind p paste-buffer # paste from the top pate buffer bind P choose-buffer # choose which buffer to paste from -# the following vi-copy bindings match my vim settings -# see https://github.com/gpakosz/.vim.git -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-copy Escape cancel -bind -t vi-copy H start-of-line -bind -t vi-copy L end-of-line +run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true' +run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true' +run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi y send -X copy-selection 2> /dev/null || true' +run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true' +run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true' +run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true' # copy to Mac OSX pasteboard if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"'