Joshua's Docs - Notes on Windows Terminal and Settings
Light

For convenience, I might refer to Windows Terminal as just WT in places throughout this page.

Settings File

You can open your settings file to edit it by using the in-app menu (Menu -> Settings)

Intellisense / Schema Support

Depending on how long ago you installed Windows Terminal, and when it was last updated, your JSON probably has a root field that looks like this:

{
	"$schema": "https://aka.ms/terminal-profiles-schema"
}

This is a URL to a JSON schema, which certain IDEs, like VSCode, can parse and use to provide type-checking and intellisense / autocomplete while you edit the settings.

If your file is missing this field, I highly recommend adding it back so you can get better validation support.

Using with Cmder / ConEmu

If you want Cmder / ConEmu as the pseudo-shell within WT, you can create an entry for it under profiles. For example, here is my entry for Cmder:

{
	"name": "Cmder",
	"hidden": false,
	"commandline": "C:\\laragon\\bin\\cmder\\Cmder.bat %projects%",
	"icon": "λ"
}

Automating Commands and Calling Programs

In addition to key bindings for WT actions, like opening a new tab, you can also setup bindings for essentially any command you would normally type into the console. By using the sendInput action type, you can have WT send input into a shell, just as if you had typed it.

Here is an example, calling the path of a script to refresh the current shell variables (getting around stale setx values):

// Useful for after using `setx`, etc.
{
	"name": "Refresh Environment Variables",
	"icon": "🔄",
	"command": {
		"action": "sendInput",
		"input": "\"C:\\ProgramData\\chocolatey\\bin\\RefreshEnv.cmd\"\n"
	},
	"keys": "f5"
}

Note: You will see that special care has to be taken to escape quotes, as well as slashes.


Troubleshooting / FAQs

  • When copying wrapped text, newlines / line breaks end up in the clipboard text
    • This appears to be addressed in #5181, but this is really for WT core - I'm still having issues with it with shells running within WT
      • For example, cmder causes this behavior, but PowerShell does not.
      • Related - #6901
  • Input has stopped appearing as you type it
    • This is actually an issue with terminals in general, and can happen for a number of reasons. The quick fix is usually to use reset or stty sane.
Markdown Source Last Updated:
Wed Jul 07 2021 09:14:40 GMT+0000 (Coordinated Universal Time)
Markdown Source Created:
Mon Apr 05 2021 13:47:08 GMT+0000 (Coordinated Universal Time)
© 2024 Joshua Tzucker, Built with Gatsby
Feedback