noparse header to disable bashdown on snippet

This commit is contained in:
BarbUk 2017-03-24 01:10:48 +04:00
parent 36ccda5f30
commit 7e7b0a8c65

9
snippy
View File

@ -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