我使用 Sublime Text 3 作为我的默认文本/代码编辑器,经常使用 Sublime Text 3 中的终端功能和 Terminus 插件。最近我发现 git 很棒,它有一个非常好用的 bash,因此我更喜欢使用 git bash 而不是通过 Windows 默认终端使用 git。
有什么方法可以实现吗?
我使用 Sublime Text 3 作为我的默认文本/代码编辑器,经常使用 Sublime Text 3 中的终端功能和 Terminus 插件。最近我发现 git 很棒,它有一个非常好用的 bash,因此我更喜欢使用 git bash 而不是通过 Windows 默认终端使用 git。
有什么方法可以实现吗?
"shell_configs":
[
{
"name": "Git Bash",
"cmd": ["cmd.exe", "/k", "C:/Program Files (x86)/Git/bin/bash.exe"],
"env": {},
"enable": true,
"default": false,
"platforms": ["windows"]
},
]
如果默认位置没有安装 Git Bash
,请将路径相应更改。如果希望默认使用它,则可以将 default
设置为 true
而不是 false
。
如果按照此处显示的方式将此设置添加到您的首选项中,则将存在唯一的 shell 配置。如果仍要能够使用其他配置,则将设置的默认值从左侧窗格复制到右侧,并将您的设置添加到列表中(请记住,所有设置都需要用逗号分隔)。
OdatNurd,谢谢您的想法,但 cmd.exe 在单独窗口中打开 git bash。我使用了您的想法,并将以下设置更改为下面的内容,在 Terminus 面板中启动 git bash shell,在 Sublime text 中显示。对我有效。
{
"shell_configs":
[
{
"name": "Git Bash",
"cmd": ["C:/Program Files/Git/bin/sh.exe"],
"env": {},
"enable": true,
"default": false,
"platforms": ["windows"]
},
]
}
前往
首选项
>
包设置
>
Terminus
>
设置
{
"default_config" : {
"windows" : "Git Bash"
},
"shell_configs":
[
{
"name": "Git Bash",
"cmd": ["C:/Program Files/Git/bin/sh.exe"],
"env": {},
"enable": true,
"default": false,
"platforms": ["windows"]
}
]
}
然后转到
首选项
>
软件包设置
>
终端
>
按键绑定
>
[
{
//alt+1 for cmd
"keys": ["alt+1"],
"command": "terminus_open",
"args" : {
"cmd": "cmd.exe",
"cwd": "${file_path:${folder}}",
"panel_name": "Terminus"
}
},
{
//alt +2 for git bash
"keys": ["alt+2"],
"command": "terminus_open",
"args" : {
"cmd": ["C:/Program Files/Git/bin/sh.exe"],
"cwd": "${file_path:${folder}}",
"panel_name": "Terminus"
}
},
]