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

Convert mp3 to wav

1  Asked on August 31, 2020 by babu-james

     

Installing the numbers module in Python

1  Asked on August 27, 2020 by user402525

   

FFmpeg – set fade opacity

0  Asked on August 26, 2020 by oskar-ahlroth

 

How can I know on which drive is Windows installed?

6  Asked on August 24, 2020 by pietro

     

Why can’t remount the disk with command?

1  Asked on August 23, 2020 by showkey

     

Powershell || Cannot Change Cursor Shape

1  Asked on August 20, 2020 by zigg

   

Can’t exclude a directory pattern recursively

2  Asked on August 14, 2020 by steve-b

 

IPv6 IPv4-like DHCP Binding

0  Asked on August 8, 2020 by dork

         

Virus / malware stored inside database

1  Asked on August 7, 2020 by adam-przedniczek

       

I can’t install pip for python 3.5

1  Asked on August 6, 2020 by dev

   

Ask a Question

Get help from others!

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