From 1a8591fcc43719685d1dbc46b5917d810551f70b Mon Sep 17 00:00:00 2001 From: Jorge Morante Date: Wed, 14 Feb 2018 22:26:36 +0100 Subject: [PATCH] pass env vars to fingers-copy-command ( IS_UPPERCASE and HINT ) --- scripts/fingers.sh | 4 +++- scripts/hints.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/fingers.sh b/scripts/fingers.sh index 44f6612..baa0849 100755 --- a/scripts/fingers.sh +++ b/scripts/fingers.sh @@ -102,6 +102,7 @@ function toggle_help_state() { function copy_result() { local result="$1" + local hint="$2" tmux set-buffer "$result" @@ -112,7 +113,8 @@ function copy_result() { fi if [ ! -z "$FINGERS_COPY_COMMAND" ]; then - tmux run-shell -b "echo -n \"$result\" | $exec_prefix $FINGERS_COPY_COMMAND > /dev/null" + is_uppercase=$(echo "$input" | grep -E '^[a-z]+$' &> /dev/null; echo $?) + tmux run-shell -b "echo -n \"$result\" | IS_UPPERCASE=$is_uppercase HINT=$hint $exec_prefix $FINGERS_COPY_COMMAND > /dev/null" fi if [[ $HAS_TMUX_YANK = 1 ]]; then diff --git a/scripts/hints.sh b/scripts/hints.sh index 9ee0ee6..c621792 100755 --- a/scripts/hints.sh +++ b/scripts/hints.sh @@ -13,7 +13,7 @@ export pane_output_temp function lookup_match() { local input=$1 - echo "$(cat $match_lookup_table | grep "^$input:" | sed "s/^$input://" | head -n 1)" + echo "$(cat $match_lookup_table | grep -i "^$input:" | sed "s/^$input://i" | head -n 1)" } function get_stdin() {