Skip to content

Instantly share code, notes, and snippets.

@morishin
Last active May 15, 2020 01:34
Show Gist options
  • Save morishin/faa6a144f7b36d062466f15510b7377b to your computer and use it in GitHub Desktop.
Save morishin/faa6a144f7b36d062466f15510b7377b to your computer and use it in GitHub Desktop.
Open Visual Studio Code command
function v() {
setopt +o nomatch # suppress zsh message
if [ -z $1 ]; then
DIR="."
else
DIR=$1
fi
WORKSPACE=`find $DIR -maxdepth 1 -name *.code-workspace 2>/dev/null`
if [ $? -eq 0 ] && [ -n "$WORKSPACE" ]; then
DIR=$WORKSPACE
fi
open -a "Visual Studio Code" $DIR
setopt -o nomatch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment