Parent directory

vscode.plugin.zsh

1303 bytes
 1# VS Code (stable / insiders) / VSCodium / Cursor zsh plugin
 2# Authors:
 3#   https://github.com/MarsiBarsi (original author)
 4#   https://github.com/babakks
 5#   https://github.com/SteelShot
 6#   https://github.com/AliSajid
 7
 8# Verify if any manual user choice of VS Code exists first.
 9if [[ -n "$VSCODE" ]] && ! which $VSCODE &>/dev/null; then
10  echo "'$VSCODE' flavour of VS Code not detected."
11  unset VSCODE
12fi
13
14# Otherwise, try to detect a flavour of VS Code.
15if [[ -z "$VSCODE" ]]; then
16  if which code &>/dev/null; then
17    VSCODE=code
18  elif which code-insiders &>/dev/null; then
19    VSCODE=code-insiders
20  elif which codium &>/dev/null; then
21    VSCODE=codium
22  elif which cursor &>/dev/null; then
23    VSCODE=cursor
24  else
25    return
26  fi
27fi
28
29function vsc {
30  if (( $# )); then
31    $VSCODE $@
32  else
33    $VSCODE .
34  fi
35}
36
37alias vsca="$VSCODE --add"
38alias vscd="$VSCODE --diff"
39alias vscg="$VSCODE --goto"
40alias vscn="$VSCODE --new-window"
41alias vscr="$VSCODE --reuse-window"
42alias vscw="$VSCODE --wait"
43alias vscu="$VSCODE --user-data-dir"
44alias vscp="$VSCODE --profile"
45
46alias vsced="$VSCODE --extensions-dir"
47alias vscie="$VSCODE --install-extension"
48alias vscue="$VSCODE --uninstall-extension"
49
50alias vscv="$VSCODE --verbose"
51alias vscl="$VSCODE --log"
52alias vscde="$VSCODE --disable-extensions"