我想为一个新的 Windows 终端配置文件分配一个键绑定,如下所示("keys": "alt+shift+d"
):
{
// Connects to a remote machine using SSH
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "SSH My Local Server",
"tabTitle": "Local Server",
"commandline": "ssh [email protected]",
"keys": "alt+shift+d"
},
有什么办法可以做到这一点?
答案1
没有keys
财产Windows 终端中的配置文件设置。但是,您可以创建自定义键绑定(键盘快捷键)在 Windows 终端内,您可以控制如何使用键盘与终端交互。
altshift+快捷键d(默认情况下)专用于打开一个新窗格 - 正如您在相应部分所看到的settings.json
:
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
您可以在此处删除此键盘快捷键并从以下内容中添加适当的部分默认绑定模式,例如(如果你的"SSH My Local Server"
是概要文件列表)
{ "command": { "action": "newTab", "index": 2 }, "keys": "alt+shift+d" },