0
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-19 04:01:21 +02:00

feat(vscode): allow arguments to vsc alias (#11903)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
Vyacheslav Scherbinin 2023-10-18 14:18:05 +07:00 committed by GitHub
parent 96c976637a
commit d3112d67a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -53,6 +53,7 @@ source $ZSH/oh-my-zsh.sh
| Alias | Command | Description | | Alias | Command | Description |
| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- | | ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| vsc | code . | Open the current folder in VS code | | 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 | | 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. | | 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. | | vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. |

View file

@ -23,7 +23,14 @@ if [[ -z "$VSCODE" ]]; then
fi fi
fi fi
alias vsc="$VSCODE ." function vsc {
if (( $# )); then
$VSCODE $@
else
$VSCODE .
fi
}
alias vsca="$VSCODE --add" alias vsca="$VSCODE --add"
alias vscd="$VSCODE --diff" alias vscd="$VSCODE --diff"
alias vscg="$VSCODE --goto" alias vscg="$VSCODE --goto"