Files
zed-config/snippets/shell script.json

69 lines
1.7 KiB
JSON

{
"shebang": {
// TODO: find a better prefix
"prefix": "env",
"body": "#!/usr/bin/env bash$0",
"description": "Bash snippet 'env'"
},
"if": {
"prefix": "if",
"body": "if [[ $1 ]]; then\n $0\nfi",
"description": "Bash snippet 'if'"
},
"while": {
"prefix": "while",
"body": "while read ${1:line}; do\n $0\ndone",
"description": "Bash snippet 'while'"
},
"for": {
"prefix": "for",
"body": "for ${1:i} in ${2:\"\\${array[@]\\}\"}; do\n $0\ndone",
"description": "Bash snippet 'for'"
},
"case": {
"prefix": "case",
"body": "case ${1:EXPRESSION} in\n ${2:PATTERN})\n ${3:STATEMENTS}\n ;;\n *)\n ${4:STATEMENTS}\n ;;\nesac$0",
"description": "Bash snippet 'case'"
},
"local": {
"prefix": "local",
"body": "local ${1:VAR}=${2:EXPR}$0",
"description": "Bash snippet 'local'"
},
"declare": {
"prefix": "declare",
"body": "declare ${1:VAR}=${1:EXPR}$0",
"description": "Bash snippet 'declare'"
},
"array": {
"prefix": "array",
"body": "\"\\${$1[${2:@}]\\}\"$0",
"description": "Bash snippet 'array'"
},
"key": {
"prefix": "key",
"body": "\"\\${!$1[${2:@}]\\}\"$0",
"description": "Bash snippet 'key'"
},
"length": {
"prefix": "len",
"body": "\"\\${#$1[@]\\}\"$0",
"description": "Bash snippet 'length'"
},
"variable": {
"prefix": "var",
"body": "\"\\${$1\\}\"$0",
"description": "Bash snippet 'variable'"
},
"subshell": {
"prefix": "sub",
"body": "\"\\$($1)\"$0",
"description": "Bash snippet 'subshell'"
},
"math": {
"prefix": "math",
"body": "\\$(($1))$0",
"description": "Bash snippet 'math'"
}
}