From 9f05dfa238344154b0dc8909ea1348ade3599fc9 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 4 Apr 2025 19:26:14 +0200 Subject: [PATCH] dsalkjlkjlkjlkjdlkjasdlkajdlksajd --- keymap.json | 6 +++++- settings.json | 4 +++- snippets/shell script.json | 44 +++++++++++++++++++++++++++----------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/keymap.json b/keymap.json index cf84ce7..94ab474 100644 --- a/keymap.json +++ b/keymap.json @@ -84,6 +84,9 @@ "ctrl-enter": "editor::GoToDefinition", // TODO: open-url, and somehow disable FindAllReferences fallback behavior here // "ctrl-enter": ["editor::GoToDefinition", "editor::OpenUrl"], + // "ctrl-k ctrl-d": "diagnostics::Deploy", + "ctrl-k ctrl-d": "editor::ToggleInlineDiagnostics", + // i'm confused "ctrl-shift-c": "editor::Copy", "ctrl-shift-v": "editor::Paste", @@ -94,7 +97,8 @@ // "ctrl-k ctrl-1": ["editor::FoldAtLevel", 0], "ctrl-k ctrl-0": "editor::UnfoldAll", - "ctrl-'": ["editor::ToggleComments", { "advance_downwards": false }], + // "ctrl-'": ["editor::ToggleComments", { "advance_downwards": false }], + "ctrl-'": ["editor::ToggleComments", { "advance_downwards": true }], "ctrl-r": "editor::ToggleLineNumbers" } diff --git a/settings.json b/settings.json index 5417d09..e07ee3f 100644 --- a/settings.json +++ b/settings.json @@ -67,7 +67,9 @@ "preview_tabs": { // Those annoying tabs that close themselves // I'd like more control over what is made ino a preview and not - "enabled": false + // "enabled": false + "enable_preview_from_code_navigation": true, + "enable_preview_from_file_finder": false }, "node": { "ignore_system_version": false diff --git a/snippets/shell script.json b/snippets/shell script.json index 956d187..a739329 100644 --- a/snippets/shell script.json +++ b/snippets/shell script.json @@ -42,17 +42,17 @@ }, "foreach": { "prefix": "foreach", - "body": "local ${1:i}\nfor ${1:i} in ${3:\"\\${${2:array}[@]\\}\"}; do\n\t$4\ndone$0", + "body": "declare ${1:i}\nfor ${1:i} in ${3:\"\\${${2:array}[@]\\}\"}; do\n\t$4\ndone$0", "description": "Bash snippet 'foreach'" }, "foreach-hashmap": { "prefix": "foreach-hashmap", - "body": "local ${1:key} ${2:val}\nfor ${1:key} in \"\\${!${3:array}[@]\\}\"; do\n\t${2:val}=\"\\${${3:array}[\"\\$${1:key}\"]}\"\n\t${4:BODY}\ndone$0", + "body": "declare ${1:key} ${2:val}\nfor ${1:key} in \"\\${!${3:array}[@]\\}\"; do\n\t${2:val}=\"\\${${3:array}[\"\\$${1:key}\"]}\"\n\t${4:BODY}\ndone$0", "description": "Bash snippet 'foreach-hashmap'" }, "for-range": { "prefix": "for-range", - "body": "local ${1:i}\nfor ${1:i} in ${4:{${2:1}..${3:10}\\}}; do\n\t$5\ndone$0", + "body": "declare ${1:i}\nfor ${1:i} in ${4:{${2:1}..${3:10}\\}}; do\n\t$5\ndone$0", "description": "Bash snippet 'for-in'" }, "case": { @@ -60,15 +60,15 @@ "body": "case ${1:EXPRESSION} in\n\t${2:PATTERN})\n\t\t${3:STATEMENTS}\n\t\t;;\n\t*)\n\t\t${4:STATEMENTS}\n\t\t;;\nesac$0", "description": "Bash snippet 'case'" }, - // todo: should is switch to 'declare' over 'local'? decare also works outside of functions + // todo: should is switch to 'declare' over 'declare'? decare also works outside of functions "local": { "prefix": "local", - "body": "local ${1:VAR}=${2:EXPR}$0", + "body": "declare ${1:VAR}\n${1:VAR}=$0", "description": "Bash snippet 'local'" }, "declare": { "prefix": "declare", - "body": "declare ${1:VAR}=${2:EXPR}$0", + "body": "declare ${1:VAR}\n${1:VAR}=$0", "description": "Bash snippet 'declare'" }, "array": { @@ -93,7 +93,7 @@ }, "read-array": { "prefix": "read-array", - "body": "local -a ${2:test}\nreadarray -d \\$'${3:\\n}' -t ${2:test} < <( ${4:CMD} )$0", + "body": "declare -a ${2:test}=()\nreadarray -td \\$'${3:\\n}' ${2:test} < <( ${4:CMD} )$0", "description": "Bash snippet 'read-array'" }, "escape-array": { @@ -127,19 +127,39 @@ "body": "<<-\"${1:EOF}\"\n\t${2:BODY}\n${1:EOF}\n$0", "description": "Bash snippet 'heredoc'" }, - "printf": { - "prefix": "printf", - "body": "printf${2: >&${1:1}} \"${3:%s}\\n\" ${4:args}$0", - "description": "Bash snippet 'printf'" - }, "echo": { "prefix": "echo", "body": "echo${2: >&${1:1}} \"${3}\"$0", "description": "Bash snippet 'echo'" }, + "printf": { + "prefix": "printf", + "body": "printf${2: >&${1:1}} \"${3:%s}\\n\" ${4:args}$0", + "description": "Bash snippet 'printf'" + }, + "die": { + "prefix": "die", + "body": "{ ${4}printf >&2 \"%s\\n\" \"${2:ERROR: ${1:args}}\"; ${4}${3:false}; ${4}}$0", + "description": "Bash snippet 'die'" + }, "command": { "prefix": "command", "body": "command -v ${1:cmd} >/dev/null$0", "description": "Bash snippet 'command'" + }, + "pid": { + "prefix": "pid", + "body": "\"\\$!\"", + "description": "Bash snippet 'pid'" + }, + "retcode": { + "prefix": "retcode", + "body": "\"\\$?\"", + "description": "Bash snippet 'retcode'" + }, + "retcode-pipe": { + "prefix": "retcode-pipe", + "body": "\"\\${PIPESTATUS[${1:0}]}\"$0", + "description": "Bash snippet 'retcode-pipe'" } }