Last active
November 19, 2015 03:26
-
-
Save amxn/d0443e993fac230cb3a7 to your computer and use it in GitHub Desktop.
Run Visual Studio Code from Zsh on Mac OSX
This file contains 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
# Currently, there isn't an automatic method for doing this, | |
# but with a little code in your `.zshrc` file, you can configure it. | |
function code { | |
if [[ $# = 0 ]] | |
then | |
open -a "Visual Studio Code" | |
else | |
local argPath="$1" | |
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}" | |
open -a "Visual Studio Code" "$argPath" | |
fi | |
} | |
# Then from Terminal you can type: | |
# `code` –– opens Visual Studio Code | |
# `code .` –– opens current directory in Visual Studio Code | |
# `code somefile` –– opens somefile in Visual Studio Code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment