summaryrefslogtreecommitdiff
path: root/plugins/vscode/vscode.plugin.zsh
diff options
context:
space:
mode:
authorDžiugas Eiva <dziugaseiva@gmail.com>2020-07-11 21:59:58 +0100
committerGitHub <noreply@github.com>2020-07-11 22:59:58 +0200
commit71f0189ed57911360b19883cb6211fe621292086 (patch)
tree233a035a9ab128597870c2302450d2a2379baa56 /plugins/vscode/vscode.plugin.zsh
parent83f61949292b865a7962f1f0a4a8c0fc6350f313 (diff)
downloadzsh-71f0189ed57911360b19883cb6211fe621292086.tar.gz
zsh-71f0189ed57911360b19883cb6211fe621292086.tar.bz2
zsh-71f0189ed57911360b19883cb6211fe621292086.zip
vscode: add support for VSCodium (#9080)
Co-authored-by: Babak K. Shandiz <babak.k.shandiz@gmail.com> Co-authored-by: Marc Cornellà <marc.cornella@live.com>
Diffstat (limited to 'plugins/vscode/vscode.plugin.zsh')
-rw-r--r--plugins/vscode/vscode.plugin.zsh27
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"