From 6693660afa6517fd3181a615ed42174eeb8e5913 Mon Sep 17 00:00:00 2001 From: Jorge Morante Date: Wed, 17 May 2017 17:30:44 +0200 Subject: [PATCH] fix tmux-yank integration with tmux 2.4 --- scripts/fingers.sh | 4 +--- scripts/utils.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/fingers.sh b/scripts/fingers.sh index 8959363..0a0901a 100755 --- a/scripts/fingers.sh +++ b/scripts/fingers.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -# TODO load fingers env eval "$(tmux show-env -g -s | grep ^FINGERS)" CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -11,6 +10,7 @@ source $CURRENT_DIR/help.sh FINGERS_COPY_COMMAND=$(tmux show-option -gqv @fingers-copy-command) HAS_TMUX_YANK=$([ "$(tmux list-keys | grep -c tmux-yank)" == "0" ]; echo $?) +tmux_yank_copy_command=$(tmux_list_vi_copy_keys | grep -E "(vi-copy|copy-mode-vi) *y" | sed 's/.*copy-pipe\(-and-cancel\)\? *"\(.*\)".*/\2/g') current_pane_id=$1 fingers_pane_id=$2 @@ -103,8 +103,6 @@ function copy_result() { fi if [[ $HAS_TMUX_YANK = 1 ]]; then - tmux_yank_copy_command=$(tmux list-keys -t vi-copy | grep "vi-copy *y" | sed 's/.*copy-pipe "\(.*\)".*/\1/g') - echo -n "$result" | eval "nohup $tmux_yank_copy_command" > /dev/null fi } diff --git a/scripts/utils.sh b/scripts/utils.sh index c64ff12..ea7f91d 100755 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -107,3 +107,13 @@ function init_pane_cmd() { echo "$set_env $init_bash" } + +function tmux_list_vi_copy_keys() { + output=$(tmux list-keys -t vi-copy 2> /dev/null) + + if [[ -z $output ]]; then + output=$(tmux list-keys -Tcopy-mode-vi) + fi + + echo "$output" +}