VS Code - 在终端中打开项目

安装 code 命令

使用快捷键 command + shift + P 打开命令面板,输入 >install code 即可安装

在终端中,使用命令 code . 即可打开当前目录到 VS Code:

Oh My Zsh 插件

启用 Oh My Zsh 的 VS Code 插件,只需修改文件 ~/.zshrc,在 plugins 中添加 vscode

plugins=(... vscode)

启用插件后,就可以使用简化命令与 VS Code 交互了,命令如下:

Alias Command Description
vsc code . Open the current folder in VS code
vsca dir code --add dir Add folder(s) to the last active window
vscd file file code --diff file file Compare two files with each other.
vscg file:line[:char] code --goto file:line[:char] Open a file at the path on the specified line and character position.
vscn code --new-window Force to open a new window.
vscr code --reuse-window Force to open a file or folder in the last active window.
vscw code --wait Wait for the files to be closed before returning.
vscu dir code --user-data-dir dir Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.
Alias Command Description
vsced dir code --extensions-dir dir Set the root path for extensions.
vscie id or vsix-path code --install-extension extension-id> or Installs an extension.
vscue id or vsix-path code --uninstall-extension id or vsix-path Uninstalls an extension.
Alias Command Description
vscv code --verbose Print verbose output (implies --wait).
vscl level code --log level Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.
vscde code --disable-extensions Disable all installed extensions.

你可能感兴趣的:(VS Code - 在终端中打开项目)