如何从 OSX 上的命令行打开 Visual Studio Code? [英] How to open Visual Studio Code from the command line on OSX?
问题描述
docs 提到了一个名为 code
的可执行文件,但我不知道在哪里可以找到它,所以我可以把它放在我的路上.我从 VSCode 站点下载的 zip 不包含任何此类可执行文件.(我可以很好地运行 .app
.)
The docs mention an executable called code
, but I'm not sure where I can find that so I can put it on my path. The zip I downloaded from the VSCode site did not include any such executable. (I am able to run the .app
just fine.)
这是仅适用于 Windows 的东西吗?
Is this a Windows-only thing?
推荐答案
来自 Visual Studio Code Setup页面:
提示:如果你想通过简单的输入'code'从终端运行VS Code,VS Code有一个命令,Shell Command: Install 'code' command in PATH, to add 'code' 到您的 $PATH 变量列表.
Tip: If you want to run VS Code from the terminal by simply typing 'code', VS Code has a command, Shell Command: Install 'code' command in PATH, to add 'code' to your $PATH variable list.
安装后,启动 VS Code.现在打开命令面板(F1 或 ⇧+⌘+P 在 Mac 上)并键入 shell 命令
以找到Shell 命令:在 PATH 中安装 'code' 命令
命令.
After installation, launch VS Code. Now open the Command Palette (F1 or ⇧+⌘+P on Mac) and type shell command
to find the Shell Command: Install 'code' command in PATH
command.
执行命令后,重新启动终端以使新的 $PATH 值生效.您只需输入代码"即可.在任何文件夹中开始编辑该文件夹中的文件.
After executing the command, restart the terminal for the new $PATH value to take effect. You'll be able to simply type 'code .' in any folder to start editing files in that folder.
这篇关于如何从 OSX 上的命令行打开 Visual Studio Code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!