From f052409a6afc88092a807089533e5dfef0d82f3d Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sat, 15 Mar 2025 03:50:08 +0100 Subject: [PATCH] ljdsakljdsalkjsad --- settings.json | 8 +++++ snippets/shell script.json | 68 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 snippets/shell script.json diff --git a/settings.json b/settings.json index 29337ff..898821d 100644 --- a/settings.json +++ b/settings.json @@ -84,5 +84,13 @@ "proto": true, "verilog": true, "vhdl": true + }, + "languages": { + "Nix": { + "tab_size": 2 + } + }, + "file_types": { + "CMake": ["CMakeLists.txt"] } } diff --git a/snippets/shell script.json b/snippets/shell script.json new file mode 100644 index 0000000..00229c8 --- /dev/null +++ b/snippets/shell script.json @@ -0,0 +1,68 @@ +{ + "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'" + } +}