From 0b6ecf92819a982cbfd572ad621088c712bfdad8 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Fri, 9 Dec 2016 13:11:52 +0400 Subject: [PATCH] handle bang snippet and copyq --- snippy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/snippy b/snippy index be07a30..a2da601 100755 --- a/snippy +++ b/snippy @@ -74,8 +74,14 @@ run(){ if [ -f "${DIR}/${FILE}" ]; then # Put the contents of the selected file into the paste buffer. - content="$(bashdown < "${DIR}/${FILE}")" - if [[ "${#content}" == 0 ]]; then + # bang is a bash template, don't pass it to bashdown + if [[ ${FILE} == "bang" ]]; then + content="$(cat "${DIR}/${FILE}")" + else + content="$(bashdown < "${DIR}/${FILE}")" + fi + # clip launch copyq + if [[ ! ${FILE} == "clip" ]] && [[ "${#content}" == 0 ]]; then printf "%s" "${FILE}" > $TMPFILE else printf "%s" "$content" > $TMPFILE