commit 33c257aa68932aeba01b93d33f401adbaf985e89
parent f3f7e25b0f0f84df3484af824d590a41f7a4f6e1
Author: Alex Balgavy <alex@balgavy.eu>
Date: Mon, 3 May 2021 17:52:25 +0200
vim: sh snippets update
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/vim/ultisnips/sh.snippets b/vim/ultisnips/sh.snippets
@@ -51,11 +51,17 @@ while [ \$((\$#)) -ne 0 ]; do
done
eval set -- "\$PARAMS"
endsnippet
+
snippet !bash "Bash shebang" b
#!/usr/bin/env bash
$0
endsnippet
+snippet !sh "Sh shebang" b
+#!/bin/sh
+$0
+endsnippet
+
snippet exists "Check if command exists" w
if ! command -v ${1:command} 1>/dev/null 2>&1; then
echo "$1 not installed." >&2
@@ -87,8 +93,8 @@ trap - INT TERM EXIT
endsnippet
snippet confirm "Ask for confirmation" b
-read -rp "${1:prompt}" -n 1 -s conf
-case "$conf" in
+printf "${1:prompt}"
+read -r conf; case "$conf"
Y|y)
${2:# code if yes}
;;