dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit a4a4500099e71b76a2e9fcc2b198605e1660c490
parent 3e1ce70424f92aeb649a1a38f4eb5a889a945917
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sun,  4 Oct 2020 10:56:52 +0200

vim: untrap snippet for shell

Former-commit-id: eb8c2a6afa0e3c8b0ffef960a9dca34aa37d458b
Diffstat:
Mvim/ultisnips/sh.snippets | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/vim/ultisnips/sh.snippets b/vim/ultisnips/sh.snippets @@ -81,6 +81,11 @@ endsnippet snippet trap "Exit trap" b trap ${1:cleanup_function} INT TERM EXIT endsnippet + +snippet untrap "Disable exit trap" b +trap - INT TERM EXIT +endsnippet + snippet confirm "Ask for confirmation" b read -rp "${1:prompt}" -n 1 -s conf case "$conf" in @@ -111,6 +116,24 @@ case "\$os" in ;; esac endsnippet + snippet contains "String contains substring" w [ -z "\${${1:strvar}##*${2:substr}*}" ]$0 endsnippet + +snippet herevar "Store heredoc in a variable" b +# EOF quoted means no var expansion, dash means ignore indentation +unset ${1:heredoc} +while IFS="$(printf "\n")" read -r line; do + $1="$(printf "%s%s" "\$$1" "$line\n")" +done <<-'EOF' +${2:heredoc contents} +EOF +endsnippet + +snippet herefile "Store heredoc in a file" b +# EOF quoted means no var expansion, dash means ignore indentation +cat <<-'EOF' > "${1:filename}" +${2:heredoc contents} +EOF +endsnippet