【问题标题】:Is there a way of opening Visual Studio Code from MacOS terminal?有没有办法从 MacOS 终端打开 Visual Studio Code?
【发布时间】:2021-08-20 12:39:21
【问题描述】:

我习惯于通过简单地在终端中键入“jupyter notebook”来打开 Jupyter Notebook,但想知道是否有办法为 VS Code 做同样的事情? (尝试以与 Jupyter 相同的方式打开它,但没有奏效)。谢谢!

【问题讨论】:

    标签: macos visual-studio-code terminal


    【解决方案1】:

    是的,您可以从终端打开 VSCode,但首先,您需要将其添加到 MacOS 的 PATH 中

    对于 zsh shell,运行以下命令

    cat << EOF >> ~/.zprofile
    Add Visual Studio Code (code)
    export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
    EOF
    

    如果您使用 bash shell 将第一行更改为 cat &lt;&lt; EOF &gt;&gt; ~/.bash_profile

    现在您可以使用以下命令从终端打开 VSCode

    • 使用上一个会话打开 VSCode - code

    • 在当前目录打开VScode - code .

    • 在 VSCode 中打开文件 - code filename

    更多命令行选项可以在这里找到VSCode CMD Line

    【讨论】:

      猜你喜欢
      • 2021-05-12
      • 1970-01-01
      • 2018-02-16
      • 2018-11-11
      • 2017-05-13
      • 1970-01-01
      • 2021-11-13
      • 1970-01-01
      • 2015-07-21
      相关资源
      最近更新 更多