文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)
这是windows独有的功能吗?
文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)
这是windows独有的功能吗?
当前回答
如果你想在你的终端上打开Visual Studio Code上的文件或文件夹,下面的iTerm等命令是你安装Visual Studio Code时默认使用的命令
从命令行打开Visual Studio Code
code --
打开整个文件夹/目录
code .
打开特定的文件
code file_name
eg:- code index.html
其他回答
我把这个添加到我的~/.profile中
alias vscode='/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron'
then
. ~/.profile
之后我就可以做了
vscode
从终点站
这是我在Mac OS Catalina上的工作方式——在这里找到(谢谢,Josiah!)
如果你在Mac OS Catalina上,你需要编辑你的.zprofile而不是.bash_profile。
编辑~/。Zprofile文件:vim ~/.zprofile 在它自己的行中添加以下代码:code () {VSCODE_CWD="$PWD" open -n -b "com.microsoft。——args $*;} 保存文件::wq 重新运行更新的文件:source ~/.zprofile。 测试运行的代码。在VS 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.
如果你想在你的终端上打开Visual Studio Code上的文件或文件夹,下面的iTerm等命令是你安装Visual Studio Code时默认使用的命令
从命令行打开Visual Studio Code
code --
打开整个文件夹/目录
code .
打开特定的文件
code file_name
eg:- code index.html
windows用户 只要输入
>code .
这里有更多命令 https://code.visualstudio.com/docs/editor/command-line