Initial commit.
This commit is contained in:
1
vim/snippets/sh/#!.snippet
Executable file
1
vim/snippets/sh/#!.snippet
Executable file
@@ -0,0 +1 @@
|
||||
#!/bin/bash
|
||||
6
vim/snippets/sh/$#.snippet
Executable file
6
vim/snippets/sh/$#.snippet
Executable file
@@ -0,0 +1,6 @@
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "${1:#missing arguments}"
|
||||
exit 1
|
||||
else
|
||||
${2:#action}
|
||||
fi
|
||||
0
vim/snippets/sh/arr.snippet
Executable file
0
vim/snippets/sh/arr.snippet
Executable file
4
vim/snippets/sh/arr/keyed.snippet
Executable file
4
vim/snippets/sh/arr/keyed.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
${1:array}[0]=${2:value}
|
||||
$1[1]=${3:value}
|
||||
$1[2]=${4:value}
|
||||
${5}
|
||||
1
vim/snippets/sh/arr/list.snippet
Executable file
1
vim/snippets/sh/arr/list.snippet
Executable file
@@ -0,0 +1 @@
|
||||
${1:array}=(${2:first} ${3:second} ${4}) ${5}
|
||||
4
vim/snippets/sh/case.snippet
Executable file
4
vim/snippets/sh/case.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
case ${1:word} in
|
||||
${2:pattern})
|
||||
${3};;
|
||||
esac
|
||||
1
vim/snippets/sh/date.snippet
Executable file
1
vim/snippets/sh/date.snippet
Executable file
@@ -0,0 +1 @@
|
||||
`system("date +%m-%d-%Y")`
|
||||
2
vim/snippets/sh/elif.snippet
Executable file
2
vim/snippets/sh/elif.snippet
Executable file
@@ -0,0 +1,2 @@
|
||||
elif [[ ${1:condition} ]]; then
|
||||
${2:#statements}
|
||||
4
vim/snippets/sh/for/c-style.snippet
Executable file
4
vim/snippets/sh/for/c-style.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
|
||||
${3:#statements}
|
||||
done
|
||||
|
||||
4
vim/snippets/sh/for/index-loop.snippet
Executable file
4
vim/snippets/sh/for/index-loop.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
for ${1:i} in ${!${2:Array}[@]}
|
||||
do
|
||||
echo "${$2[$1]}"
|
||||
done
|
||||
3
vim/snippets/sh/for/list.snippet
Executable file
3
vim/snippets/sh/for/list.snippet
Executable file
@@ -0,0 +1,3 @@
|
||||
for ${1:var} in $${2:list}; do
|
||||
echo "$$1"
|
||||
done
|
||||
5
vim/snippets/sh/for/numargs.snippet
Executable file
5
vim/snippets/sh/for/numargs.snippet
Executable file
@@ -0,0 +1,5 @@
|
||||
numargs=$#
|
||||
for ((i=1 ; i <= numargs ; i++)); do
|
||||
echo "$1"
|
||||
shift
|
||||
done
|
||||
4
vim/snippets/sh/for/times-sequence.snippet
Executable file
4
vim/snippets/sh/for/times-sequence.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
for ${1:i} in {${2:1}..${3:10}}
|
||||
do
|
||||
echo "$$1"
|
||||
done
|
||||
4
vim/snippets/sh/fore.snippet
Executable file
4
vim/snippets/sh/fore.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
for ${2:i} in ${1:array}
|
||||
do
|
||||
echo $2
|
||||
done
|
||||
3
vim/snippets/sh/fun.snippet
Executable file
3
vim/snippets/sh/fun.snippet
Executable file
@@ -0,0 +1,3 @@
|
||||
function ${1:name}(){
|
||||
${2:Commands}
|
||||
}
|
||||
5
vim/snippets/sh/gt.snippet
Executable file
5
vim/snippets/sh/gt.snippet
Executable file
@@ -0,0 +1,5 @@
|
||||
if [ ${1:$var} -gt ${2:$other} ]; then
|
||||
echo 'Greater than $2'
|
||||
else
|
||||
echo 'Less than $2'
|
||||
fi
|
||||
3
vim/snippets/sh/if.snippet
Executable file
3
vim/snippets/sh/if.snippet
Executable file
@@ -0,0 +1,3 @@
|
||||
if [[ ${1:condition} ]]; then
|
||||
${2:#statements}
|
||||
fi
|
||||
1
vim/snippets/sh/ifdir.snippet
Executable file
1
vim/snippets/sh/ifdir.snippet
Executable file
@@ -0,0 +1 @@
|
||||
[ -d ${1:namedir} ] || mkdir $1 ; cd $1
|
||||
5
vim/snippets/sh/ife.snippet
Executable file
5
vim/snippets/sh/ife.snippet
Executable file
@@ -0,0 +1,5 @@
|
||||
if [[ ${1:condition} ]]; then
|
||||
${2:#statements}
|
||||
else
|
||||
${3:#statements}
|
||||
fi
|
||||
4
vim/snippets/sh/iffile.snippet
Executable file
4
vim/snippets/sh/iffile.snippet
Executable file
@@ -0,0 +1,4 @@
|
||||
if [ ! -e ${1:filename} ]; then
|
||||
echo "file $1 not present"
|
||||
fi
|
||||
|
||||
7
vim/snippets/sh/ifroot.snippet
Executable file
7
vim/snippets/sh/ifroot.snippet
Executable file
@@ -0,0 +1,7 @@
|
||||
# Need to be logged in as root
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo " Need be root"
|
||||
sleep 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
5
vim/snippets/sh/lt.snippet
Executable file
5
vim/snippets/sh/lt.snippet
Executable file
@@ -0,0 +1,5 @@
|
||||
if [ ${1:$var} -lt ${2:$other} ]; then
|
||||
echo 'Less than $2'
|
||||
else
|
||||
echo 'Greater than $2'
|
||||
fi
|
||||
8
vim/snippets/sh/sh.snippet
Executable file
8
vim/snippets/sh/sh.snippet
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# Created on: `system("date +%m-%d-%Y")`
|
||||
# Last Change: `system("date +%m-%d-%Y")`
|
||||
# vim:ft=sh:fdm=syntax:nu:
|
||||
# Description: ${1:description}
|
||||
# Author: ${2:`system("whoami")`}
|
||||
# Url: ${3:url}
|
||||
|
||||
5
vim/snippets/sh/usage.snippet
Executable file
5
vim/snippets/sh/usage.snippet
Executable file
@@ -0,0 +1,5 @@
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $(basename $${1:0}) ${2:argument}"
|
||||
echo "${3:explanation}"
|
||||
}
|
||||
3
vim/snippets/sh/while.snippet
Executable file
3
vim/snippets/sh/while.snippet
Executable file
@@ -0,0 +1,3 @@
|
||||
while [[ ${1:condition} ]]; do
|
||||
${2:#statements}
|
||||
done
|
||||
5
vim/snippets/sh/yesno/longer.snippet
Executable file
5
vim/snippets/sh/yesno/longer.snippet
Executable file
@@ -0,0 +1,5 @@
|
||||
echo -n "Do you wish to ${1:#question}" '[y/n] ' ; read ${2:ans}
|
||||
case "$$2" in
|
||||
y*|Y*) ${3:#statement} ;;
|
||||
*) ${4:#statement};;
|
||||
esac
|
||||
6
vim/snippets/sh/yesno/simple.snippet
Executable file
6
vim/snippets/sh/yesno/simple.snippet
Executable file
@@ -0,0 +1,6 @@
|
||||
read ${1:yn}
|
||||
if [[ $$1 =~ [Yy] ]]; then
|
||||
echo "${2:#statement}"
|
||||
else
|
||||
echo "${3:#statement}"
|
||||
fi
|
||||
Reference in New Issue
Block a user