7ff77120c17b83ca1c5d4939d21c1a84a4b2ffbb

Author
Babak K. Shandiz <babak.k.shandiz@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

vscode: use insiders build if stable not found (#8568)

* 🔨 Add calling VS Code Insiders

* ✏️ Update README.md

Diff

This diff is truncated to protect this page.

 1diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md
 2index 74b5a45aa0e34cb45845b831935fcab32d36b8a4..2c6530650b995c40c145e04d18fa73bc1c8e5d39 100644
 3--- a/plugins/vscode/README.md
 4+++ b/plugins/vscode/README.md
 5@@ -1,6 +1,6 @@
 6-# VS code
 7+# VS Code
 8 
 9-This plugin makes interaction between the command line and the code editor easier.
10+This plugin makes interaction between the command line and the VS Code editor easier.
11 
12 To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`:
13 
14@@ -8,9 +8,11 @@ To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`
15 plugins=(... vscode)
16 ```
17 
18-If you are using [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/),
19-add the following line in the oh-my-zsh settings section (between the `ZSH_THEME` and
20-the `plugins=()` line). This will make the plugin use the Insiders version instead.
21+## VS Code Insiders
22+
23+🍏 **If you are only using [VS Code Insiders](https://code.visualstudio.com/insiders/), the plugin will automatically bind to your Insiders installation.**
24+
25diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh
26index 4c15df2b0acbf87be96ca17b3c760b75456e4abb..0144e0baa5c60d988bf22255407958d8d8a10076 100644
27--- a/plugins/vscode/vscode.plugin.zsh
28+++ b/plugins/vscode/vscode.plugin.zsh
29@@ -1,9 +1,17 @@
30 # VScode zsh plugin
31-# author: https://github.com/MarsiBarsi
32+# Authors:
33+#   https://github.com/MarsiBarsi (original author)
34+#   https://github.com/babakks
35 
36-# Use main Visual Studio Code version by default
37-: ${VSCODE:=code}
38+# Use the stable VS Code release, unless the Insiders version is the only
39+# available installation
40+if ! which code > /dev/null && which code-insiders > /dev/null; then
41+  : ${VSCODE:=code-insiders}
42+else
43+  : ${VSCODE:=code}
44+fi
45 
46+# Define aliases
47 alias vsc="$VSCODE ."
48 alias vsca="$VSCODE --add"
49 alias vscd="$VSCODE --diff"