自定义外壳配置文件保存在settings.json
文件中;要打开它进行编辑,请Preferences: Open Settings (JSON)
从命令面板 ( Ctrl-Shift-P) 中选择。
有特定于平台的命名属性terminal.integrated.profiles.*
,其中*
要么windows
,linux
或osx
(MacOS的)。
每个内部的属性定义外壳配置文件,即可通过标记为( )的下拉菜单在集成终端中运行的外壳。+
每个shell-profile 定义:
至少需要一个path
参数来指定 shell 可执行文件的完整路径,或者,仅在 Windows 上,需要一个source
参数,该参数可以是VS CodePowerShell
或Git Bash
让 VS Code 找到适当的可执行文件。
启动参数通过args
.
有关所有支持的属性,请参阅文档。
要设置默认的shell 配置文件:
要么:使用Terminal: Select Default Profile
命令面板中的命令:将显示所有定义的配置文件的列表;选择一个感兴趣的。
或者:将适合平台的terminal.integrated.defaultProfile.*
属性设置为所需的 shell 配置文件的名称。
示例:node.exe
在 Windows 上将Node.js ( )定义为自定义 shell 配置文件:
node.exe
和转义\
字符;例如,来自 PowerShell:# Get node.exe's full path, escape '\' chars., copy to the clipboard.
(Get-Command node.exe).Path.Replace('\', '\\') | Set-Clipboard
settings.json
文件中(如果该terminal.integrated.profiles.windows
属性已存在,只需将该属性添加Node.js
到其中);该示例使用node.exe
的默认安装位置C:\Program Files\nodejs\node.exe
。"terminal.integrated.profiles.windows": {
"Node.js": {
"path": "C:\\Program Files\\nodejs\\node.exe",
"args": [] // Add startup arguments as needed.
}
}
// Make Node.js the default shell (if the property already exists, update its value).
"terminal.integrated.defaultProfile.windows": "Node.js"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句