Skip to content

Commit

Permalink
sh: Add snippets for 'if' and 'func'
Browse files Browse the repository at this point in the history
- add portable if test expr
- add snippets to create function
  • Loading branch information
iiey authored and lpil committed Jul 11, 2021
1 parent 749460b commit e77399e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion UltiSnips/sh.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ snippet here "here document (here)"
${1/['"`](.+)['"`]/$1/}
endsnippet

snippet /ift(est)?/ "if ... then (if)" rb
if ${2:[ ${1:condition} ]}; then
${0:${VISUAL}}
fi
endsnippet

snippet if "if ... then (if)" b
if ${2:[[ ${1:condition} ]]}; then
if [[ ${1:condition} ]]; then
${0:${VISUAL}}
fi
endsnippet
Expand All @@ -92,4 +98,10 @@ while ${2:[[ ${1:condition} ]]}; do
done
endsnippet

snippet func "function() {...}" b
${1:function} () {
${0:${VISUAL}}
}
endsnippet

# vim:ft=snippets:

0 comments on commit e77399e

Please sign in to comment.