summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorVyacheslav Scherbinin <shcherbinin@ccfit.nsu.ru>2023-10-18 14:18:05 +0700
committerGitHub <noreply@github.com>2023-10-18 09:18:05 +0200
commitd3112d67a3eb55fc39975f917467704ebb2c296b (patch)
treeb662c4c6cbf3c90c874929b2230beda81981d04d /plugins
parent96c976637a4112e1e72a1a449ac51d78acc67597 (diff)
downloadzsh-d3112d67a3eb55fc39975f917467704ebb2c296b.tar.gz
zsh-d3112d67a3eb55fc39975f917467704ebb2c296b.tar.bz2
zsh-d3112d67a3eb55fc39975f917467704ebb2c296b.zip
feat(vscode): allow arguments to `vsc` alias (#11903)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/vscode/README.md3
-rw-r--r--plugins/vscode/vscode.plugin.zsh9
2 files changed, 10 insertions, 2 deletions
diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md
index e95ed5d4f..726b23d35 100644
--- a/plugins/vscode/README.md
+++ b/plugins/vscode/README.md
@@ -31,7 +31,7 @@ the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell
## Using multiple flavours
-If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code Insiders, you can
+If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code Insiders, you can
manually specify the flavour's executable. Add the following line to the .zshrc file (between the `ZSH_THEME` and the `plugins=()` lines).
This will make the plugin use your manually defined executable.
@@ -53,6 +53,7 @@ source $ZSH/oh-my-zsh.sh
| Alias | Command | Description |
| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| vsc | code . | Open the current folder in VS code |
+| vsc `dir` | code `dir` | Open passed folder in VS code |
| vsca `dir` | code --add `dir` | Add folder(s) to the last active window |
| vscd `file` `file` | code --diff `file` `file` | Compare two files with each other. |
| vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. |
diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh
index 48d904377..356c62360 100644
--- a/plugins/vscode/vscode.plugin.zsh
+++ b/plugins/vscode/vscode.plugin.zsh
@@ -23,7 +23,14 @@ if [[ -z "$VSCODE" ]]; then
fi
fi
-alias vsc="$VSCODE ."
+function vsc {
+ if (( $# )); then
+ $VSCODE $@
+ else
+ $VSCODE .
+ fi
+}
+
alias vsca="$VSCODE --add"
alias vscd="$VSCODE --diff"
alias vscg="$VSCODE --goto"