AnswerBun.com

assign keybinding to windows terminal profile

Super User Asked on January 3, 2022

I would like to assign to one of the new windows terminal profiles a keybinding, as in the following ("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"
        },

what is the way to do this?

One Answer

There is no keys property in Profile settings in Windows Terminal. However, you can create custom key bindings (keyboard shortcuts) inside Windows Terminal that give you control of how you interact with the terminal using your keyboard.

The altshift+d shortcut is (by default) dedicated to open a new pane - as you can see in the corresponding part of 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" }
]

You can delete this keyboard shortcut here and add appropriate part from the following default binding schema, for instance (if your "SSH My Local Server" is the 3rd entry in the profile list)

{ "command": { "action": "newTab", "index": 2 }, "keys": "alt+shift+d" },

Answered by JosefZ on January 3, 2022

Add your own answers!

Related Questions

miniDLNA (ReadyMedia) disconnects after few minutes

1  Asked on December 13, 2021 by sebastian-schlicht

       

Open URL with Windows Explorer

4  Asked on December 13, 2021 by user1001972

     

Excel PivotTable Date Grouping in 24-hr Center

1  Asked on December 13, 2021 by brian-silva

     

Unknown IP address trying to log on to my web server

1  Asked on December 13, 2021 by andrew-morton

   

Why is reaver not guessing the correct PIN?

2  Asked on December 13, 2021 by creative-magic

     

Windows 10 only boots after running chkdsk /f

0  Asked on December 13, 2021 by timvk

     

mv: rename X to Y: No such file or directory

1  Asked on December 11, 2021 by roccobarbi

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir