Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Get Windows Terminal KeyBindings

Posted on December 18, 2020December 18, 2020

As many of you know I am a big fan and daily user of Windows Terminal. So much so, that I wrote a PowerShell module called WTToolBox that you can install from the PowerShell Gallery. I've pushed a new version that does a better of getting key bindings.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

Windows Terminal makes use of a number of keybindings (think keyboard shortcuts) that you can use. This means you can keep your hands on the keyboard instead of reaching for a mouse. My challenge has been that I've never taken the time to learn them, or at least the few I am likely to use on a daily basis. Part of the challenge is discoverability. The keybindings are defined in your settings.json file and you can add your own as well.

So instead of constantly looking at the file, I updated the Get-WTKeyBinding command in the WTToolbox module to make this super easy.

get windows terminal keybindings

There are key bindings defined in the default settings file as well as anything that you define. Earlier versions of this command included formatting. I have no idea what I was thinking other than being lazy. As a best practice you should never include the formatting commands in your function. You want to write objects to the pipeline.

That's what I've done with the latest version. I tweaked the output to insert a custom typename.

$k.psobject.typenames.insert(0,"wtKeyBinding")
$list.add($k)

Then I used New-PSFormatXML from the PSScriptTools module to create a format.ps1xml file. I created a default table view and one for Format-List.

get windowsterminal key binding list

I also modified the command to let you specify an action. The function will tab complete all possible actions or you can use a wildcard pattern.

If you use Windows Terminal, I hope you'll give it a try and let me know what you think.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d