diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2020-07-25 21:01:02 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2020-07-25 21:01:02 -0600 |
commit | 1edd2c43b12f9f2c2ef04cfa0428db0f7fc0aa7c (patch) | |
tree | e6aeb9029206948167619f4dc1c2ec42c4040ab4 /plugins/vscode/vscode.plugin.zsh | |
parent | 59344b5c59b7190ad3b14a2e8e02db8b5559141b (diff) | |
parent | 95218372402afc9aeafc89c0984310387ce79599 (diff) | |
download | zsh-1edd2c43b12f9f2c2ef04cfa0428db0f7fc0aa7c.tar.gz zsh-1edd2c43b12f9f2c2ef04cfa0428db0f7fc0aa7c.tar.bz2 zsh-1edd2c43b12f9f2c2ef04cfa0428db0f7fc0aa7c.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'plugins/vscode/vscode.plugin.zsh')
-rw-r--r-- | plugins/vscode/vscode.plugin.zsh | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh index 0144e0baa..48d904377 100644 --- a/plugins/vscode/vscode.plugin.zsh +++ b/plugins/vscode/vscode.plugin.zsh @@ -1,17 +1,28 @@ -# VScode zsh plugin +# VS Code (stable / insiders) / VSCodium zsh plugin # Authors: # https://github.com/MarsiBarsi (original author) # https://github.com/babakks +# https://github.com/SteelShot -# Use the stable VS Code release, unless the Insiders version is the only -# available installation -if ! which code > /dev/null && which code-insiders > /dev/null; then - : ${VSCODE:=code-insiders} -else - : ${VSCODE:=code} +# Verify if any manual user choice of VS Code exists first. +if [[ -n "$VSCODE" ]] && ! which $VSCODE &>/dev/null; then + echo "'$VSCODE' flavour of VS Code not detected." + unset VSCODE +fi + +# Otherwise, try to detect a flavour of VS Code. +if [[ -z "$VSCODE" ]]; then + if which code &>/dev/null; then + VSCODE=code + elif which code-insiders &>/dev/null; then + VSCODE=code-insiders + elif which codium &>/dev/null; then + VSCODE=codium + else + return + fi fi -# Define aliases alias vsc="$VSCODE ." alias vsca="$VSCODE --add" alias vscd="$VSCODE --diff" |