From a11afa87567ed6d16c74c1bca9dbecbe390b0e46 Mon Sep 17 00:00:00 2001 From: Raimon Grau Date: Sun, 2 Dec 2018 14:19:35 +0000 Subject: [PATCH] Pass current_pane_id as a parameter to copy command Passing this variable allows the copy command to interact with the current pane (tmux send-keys, for example). --- scripts/fingers.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/fingers.sh b/scripts/fingers.sh index 509e446..01ae989 100755 --- a/scripts/fingers.sh +++ b/scripts/fingers.sh @@ -124,10 +124,18 @@ function copy_result() { is_uppercase=$(echo "$input" | grep -E '^[a-z]+$' &> /dev/null; echo $?) + copy_command_parameters=<<-EOS + printf \"$result\" | + IS_UPPERCASE=$is_uppercase + HINT=$hint + CURRENT_PANE_ID=$current_pane_id + $exec_prefix + EOS + if [[ $is_uppercase == "1" ]] && [ ! -z "$FINGERS_COPY_COMMAND_UPPERCASE" ]; then - tmux run-shell -b "printf \"$result\" | IS_UPPERCASE=$is_uppercase HINT=$hint $exec_prefix $FINGERS_COPY_COMMAND_UPPERCASE" + tmux run-shell -b "$copy_command_parameters $FINGERS_COPY_COMMAND_UPPERCASE" elif [ ! -z "$FINGERS_COPY_COMMAND" ]; then - tmux run-shell -b "printf \"$result\" | IS_UPPERCASE=$is_uppercase HINT=$hint $exec_prefix $FINGERS_COPY_COMMAND" + tmux run-shell -b "$copy_command_parameters $FINGERS_COPY_COMMAND" fi if [[ $HAS_TMUX_YANK = 1 ]]; then