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 <extension-vsix-path 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.
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容