diff --git a/snippy b/snippy index 9a3a943..ae7e4f1 100755 --- a/snippy +++ b/snippy @@ -4,7 +4,8 @@ # augmented by barbuk: https://github.com/BarbUk/dotfiles/blob/master/bin/snippy # . restore current clipboard # . {clipboard} placeholder to use current clipboard in snippet -# . {cursor} placeholder to place the cursor +# . {cursor} placeholder to place the cursor +# . ##noparse header in snippet to not parse # augmented by "opennomad": https://gist.github.com/opennomad/15c4d624dce99066a82d # originally written by "mhwombat": https://bbs.archlinux.org/viewtopic.php?id=71938&p=2 # Based on "snippy" by "sessy" @@ -74,9 +75,9 @@ run(){ if [ -f "${DIR}/${FILE}" ]; then # Put the contents of the selected file into the paste buffer. - # bang is a bash template, don't pass it to bashdown - if [[ ${FILE} == "bang" ]]; then - content="$(cat "${DIR}/${FILE}")" + # don't parse file with the ##noparse header + if grep -qE "^##noparse" "${FILE}"; then + content="$(tail -n +2 "${DIR}/${FILE}")" else content="$(bashdown < "${DIR}/${FILE}")" fi