Problem:
I wanted to launch Microsoft’s Visual Studio Code from the command line at will.
What I did:
- Launch VS Code
- Hit cmd-shift-p (⌘-⇧-P)
- Begin to type Shell … and choose and execute “Shell Command: Install ‘code’ command in PATH”
- Launch Terminal and check to see if VS Code launches by typing the
code
command. - Edit the
.bash_profile
file in the home folder and change the$EDITOR
variable like so …
# Setting Visual Studio Code as $EDITOR
export VISUAL=code
export EDITOR="$VISUAL"
And that should just about do it.
Restart the terminal or source the bash_profile file for changes to take effect.