Created
May 28, 2015 14:17
-
-
Save cdevroe/4fb3ebf7806b39020c33 to your computer and use it in GitHub Desktop.
Open Visual Studio Code from Terminal
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
code () { | |
if [[ $# = 0 ]] | |
then | |
open -a "Visual Studio Code" -n | |
else | |
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}" | |
open -a "Visual Studio Code" -n --args "$F" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this to ~/.bashrc
code -- opens Visual Studio Code
code . -- opens current directory in Visual Studio Code
code somefile -- opens somefile in Visual Studio Code
Inspired by http://kevgriffin.com/how-to-run-visual-studio-code-from-terminal-on-mac-osx/
The only thing I added to my script was that Code will open a new window each time so that you can open multiple projects at once.