-
-
Save morishin/faa6a144f7b36d062466f15510b7377b to your computer and use it in GitHub Desktop.
Open Visual Studio Code command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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