Run / Open VSCode from Mac Terminal

后端 未结 16 1164
忘了有多久
忘了有多久 2020-12-07 07:01

I\'d like to run / open Visual Studio Code from the Mac OSX Terminal by running this command code .. I found instructions here:

https://code.visualstud

16条回答
  •  眼角桃花
    2020-12-07 07:25

    I just want to pull out Benjamin Pasero's answer from inside his comment as it seems the best solution. It is the tip given on the Setting up Visual Studio Code page where it says ...

    If you want to run VS Code from the terminal, append the following to your ~/.bash_profile file (~/.zshrc in case you use zsh).

    code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
    

    Now, you can simply type code . in any folder to start editing files in that folder. [Or code test.txt to go to work on the test.txt file]

提交回复
热议问题