Setting Visual Studio Code as my Mac's default editor (including editing Git commits)
Add export EDITOR="code -w"
to your bash profile
(Your bash profile is accessible via open ~/.bash_profile
)
This requires you to have the code
binary already in your path. If you don't have that, or don't know if you do, simply go into vscode, enter CMD + SHIFT + P
, type code and click Shell Command: Install 'code' command in PATH. Then do the first step.
Also, very helpful comment by pompalini below,
remember to "refresh" terminal by closing and opening it again or resourcing your bash profile by running
source ~/.bash_profile
. Only then will the new changes in.bash_profile
apply to your terminal.
In terminal
Type:
open ~/.bash_profile
Insert:
export EDITOR="code -w"
In visual studio code
- Press:
CMD + SHIFT + P
- Insert:
install code
and select from autocomplete menushell command: Install 'code' in command PATH
- Press:
It's working with the latest version 0.10.9 of VS Code
[core]
editor = '/Applications/Visual Studio Code.app/Contents/MacOS/Electron' -w
Test it with: git config --global --edit. remember to refresh the terminal after you have changed the config file.