mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-31 04:57:57 +00:00
24b3b106ce
The UltiSnips snippets are still there, I just have to port them slowly over time.
55 lines
898 B
Plaintext
Executable File
55 lines
898 B
Plaintext
Executable File
snippet if "If statement" iw
|
|
if [[ ${1:<condition>} ]]; then
|
|
${2:<expression>}
|
|
fi
|
|
endsnippet
|
|
|
|
snippet while_shift "A dependency-less option parser" iw
|
|
while [[ $# -gt 0 ]]; then
|
|
do
|
|
case $1 in
|
|
-h|--help)
|
|
echo "$help_section"
|
|
exit 0
|
|
;;
|
|
$2
|
|
esac
|
|
done
|
|
endsnippet
|
|
|
|
snippet if "If conditional" iw
|
|
if ${1:<expression>}; then
|
|
${2:<expression>}
|
|
fi
|
|
endsnippet
|
|
|
|
snippet while "While loop" iw
|
|
while ${1:<expression>};
|
|
do
|
|
${2:<expression>}
|
|
done
|
|
endsnippet
|
|
|
|
snippet select "Select loop stuff" iw
|
|
select ${1:<VARIABLE_NAME>} in ${2:foo bar baz}
|
|
do
|
|
${3:# Your stuff here}
|
|
done
|
|
$0
|
|
endsnippet
|
|
|
|
snippet getopts "An argument parser with getopts" iw
|
|
while getopts ${1:<OPTSTRING>} ${2:arg}
|
|
do
|
|
case ${2:"h"} in
|
|
h)
|
|
echo $_help
|
|
exit 0
|
|
*)
|
|
echo $_help
|
|
exit 0
|
|
esca
|
|
done
|
|
endsnippet
|
|
|