Skip to content

Commit e77399e

Browse files
iieylpil
authored andcommitted
sh: Add snippets for 'if' and 'func'
- add portable if test expr - add snippets to create function
1 parent 749460b commit e77399e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

UltiSnips/sh.snippets

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,14 @@ snippet here "here document (here)"
7474
${1/['"`](.+)['"`]/$1/}
7575
endsnippet
7676

77+
snippet /ift(est)?/ "if ... then (if)" rb
78+
if ${2:[ ${1:condition} ]}; then
79+
${0:${VISUAL}}
80+
fi
81+
endsnippet
82+
7783
snippet if "if ... then (if)" b
78-
if ${2:[[ ${1:condition} ]]}; then
84+
if [[ ${1:condition} ]]; then
7985
${0:${VISUAL}}
8086
fi
8187
endsnippet
@@ -92,4 +98,10 @@ while ${2:[[ ${1:condition} ]]}; do
9298
done
9399
endsnippet
94100

101+
snippet func "function() {...}" b
102+
${1:function} () {
103+
${0:${VISUAL}}
104+
}
105+
endsnippet
106+
95107
# vim:ft=snippets:

0 commit comments

Comments
 (0)