From 7d01e47369f447bc7e571b78c533f60105e87147 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Wed, 2 Nov 2016 20:58:26 +0400 Subject: [PATCH] alfred snippet import --- snippy | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/snippy b/snippy index 0130132..30777b0 100755 --- a/snippy +++ b/snippy @@ -79,16 +79,21 @@ run(){ else ${FILE} &> $TMPFILE # execute as bashcommand fi - local old - old=$(xsel -b) - xsel -b --input < $TMPFILE + + local current_clip + current_clip=$(xsel -b) + + # replace {clipboard} by the cliboard comtent + sed -i -e "s/{clipboard}/$current_clip/g" "$TMPFILE" + + xsel -b --input < "$TMPFILE" # Paste into the current application. if is_window; then ${GUIPASTE} else ${CLIPASTE} fi - echo -ne "$old" | xsel -b --input + echo -ne "$current_clip" | xsel -b --input } is_window(){