title: Setting Visual Studio Code as my Mac's default editor (including editing Git commits)
body: <p>I am trying to configure my Mac Book Pro (OSX El Capitan 10.11.1) to use Visual Studio Code as its default editor. I have created a <code>~/.bash_profile</code> file with the following two lines</p>
  
  <pre class="lang-bash prettyprint-override"><code>vscode () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
  export VISUAL=open\ -n\ -b\ "com.microsoft.VSCode"
  </code></pre>
  
  <p>This works for some things: I can type <code>vscode test.txt</code> at the bash terminal and up pops <code>test.txt</code> in Visual Studio Code, and if I run the command <code>env</code> I see <code>VISUAL=open -n -b com.microsoft.VSCode</code> in the list. I can even just type <code>$VISUAL</code> and Visual Studio Code opens on a new empty file.</p>
  
  <p>But if I type <code>git commit</code> I get the following error</p>
  
  <blockquote>
    <p>error: cannot run com.microsoft.vscode: No such file or directory<br>
    error: unable to start editor 'com.microsoft.vscode' Please supply the<br>
    message using either -m or -F option.  </p>
  </blockquote>
  
  <p>So I have succeeded inasmuch as git is trying to open Visual Studio Code for me to edit my commit message but it is then failing.</p>
  
  <p>What <code>X</code> should I use in the line <code>export VISUAL=X</code> in my <code>~/.bash_profile</code> file to enable git to open Visual Studio Code for commit messages?</p>
  
  <p>(N.B. <a href="https://stackoverflow.com/q/30024353/575530">How to use Visual Studio Code as Default Editor for Git</a> is not a duplicate since Gary is on a Windows PC.)</p>