commit 3633af7f7e11702b5b6f42f0bbeda50ba0a2b1ae
parent f62974d78510ed853e311c8e595b217a91ab5443
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Mon, 16 Sep 2019 20:56:03 -0400
vim: more snippets
Former-commit-id: 67b08fac7eacbf839cec2ddd3468b9f2e36b70f1
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/vim/ultisnips/sh.snippets b/vim/ultisnips/sh.snippets
@@ -51,7 +51,6 @@ while (( "\$#" )); do
done
eval set -- "\$PARAMS"
endsnippet
-
snippet !bash "Bash shebang" b
#!/usr/bin/env bash
$0
@@ -71,6 +70,7 @@ die() {
exit 1
}
$0
+endsnippet
snippet func "Function definition" b
${1:function_name}() {
@@ -81,3 +81,15 @@ endsnippet
snippet trap "Exit trap" b
trap ${1:cleanup_function} INT TERM EXIT
endsnippet
+snippet confirm "Ask for confirmation" b
+read -rp "${1:promp}" -n 1 -s conf
+case "$conf" in
+ Y|y)
+ ${2:# code if yes}
+ ;;
+ *)
+ ${3:# code otherwise}
+ ;;
+esac
+$0
+endsnippet