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
codecommand. - Edit the
.bash_profilefile in the home folder and change the$EDITORvariable like so …
# Setting Visual Studio Code as $EDITORexport VISUAL=codeexport EDITOR="$VISUAL"
And that should just about do it.
Restart the terminal or source the bash_profile file for changes to take effect.