This extension contains keyword snippets and micro patterns for shell script.
- Added
l13Snippets.shellScript.useFunctionBlockPadding
to enable or disable line padding in function blocks.
- Introduction
- Shortcut rules for Shell Script
- Recommended Settings
- Recommended Keyboard Shortcuts
- Recommended Extensions
The idea of those snippets is to create a workflow with micro patterns. Write one to four characters and you get the keyword or pattern.
Some prefixes are twice, because the rules are matching different patterns like e1
-> echo ;
and export ;
. Then you have to pick the right one.
The following prefixes are just examples to explain the rules. To see the complete list, please visit SNIPPETS.md. If a keyword or pattern might be missing, please open an issue on Github and make a suggestion.
Prefix | Snippet |
---|---|
n |
null |
f |
false |
t |
true |
itf |
if CONDITION; then ... fi |
wdd |
while CONDITION; do ... done |
Prefix | Snippet |
---|---|
_ |
"${}" |
__ |
"$()" |
Prefix | Snippet |
---|---|
f_ |
function NAME { ... } |
$_ |
NAME () { ... } |
Prefix | Snippet |
---|---|
e1 |
echo ...; |
s1 |
shift$0; |
Prefix | Snippet |
---|---|
_) |
) ... ;; |
_* |
*) ... ;; |
Prefix | Snippet |
---|---|
s1b |
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.sh"; |
s1z |
source "$(cd "$(dirname "${(%):-%x}")" && pwd)/.zsh"; |
Prefix | Snippet |
---|---|
$b |
#!/usr/bin/env bash main () { ... exit 0; };main "$@"; |
$z |
#!/usr/bin/env zsh main () { ... exit 0; };main "$@"; |
It is recommended to set the snippet suggestions to top.
"editor.snippetSuggestions": "top",
Please have the following keyboard shortcuts always in mind, because these are fundamental to get the most out of it. Every tab stop is used only if necessary, because it prevents VS Code to open the IntelliSense menu automatically. So sometimes DownArrow
or Cmd/Ctrl + Enter
can have the same effect.
Tab
- Jump to the next tab stop of the snippet.DownArrow
- Move the caret down one line.Cmd + Enter
- Insert line below, even if the caret is in the middle of a line.Cmd + Shift + Enter
- Insert line above, even if the caret is in the middle of a line.
Tab
- Jump to the next tab stop of the snippet.DownArrow
- Move the caret down one line.Ctrl + Enter
- Insert line below, even if the caret is in the middle of a line.Ctrl + Shift + Enter
- Insert line above, even if the caret is in the middle of a line.