文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)
这是windows独有的功能吗?
文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)
这是windows独有的功能吗?
当前回答
我有一个~/bin/code shell脚本,它与@BengaminPasero写的命令相匹配。
#!/bin/bash
VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $*
我把~/bin:前缀到我的$PATH,这允许我在不污染~/的情况下添加一堆一次性脚本。bash_profile脚本。
其他回答
对于Windows,您可以使用命令:
start Code filename.extension
上面这句话对我很适用。
我们将脚本更新为以下语法,以支持多个文件和文件夹作为参数,并修复了无法正确检测当前工作目录的问题:
code () {
VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $*
}
VS Code 1.0版本更新:
请从命令面板(查看|命令面板)使用命令在路径中安装“代码”命令或在路径中安装“代码内部人员”命令,使代码可用于命令行。
如果你在下载文件夹中安装你的vs code,你需要将vs code移动到应用程序文件夹,然后打开vs code,然后按shift + command + p,你会看到下图。然后你需要输入代码。现在可以开始了。
如果你正在使用VS Code Insiders:
code-insiders .
如果你使用VS Code:
code .
从Visual Studio代码设置页面:
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. 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. 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.