Skip to content

Seamless Windows Terminal Integration

Adam edited this page Sep 17, 2022 · 31 revisions

Introduction

Windows Terminal is a new, modern, feature-rich, productive terminal emulator for Windows 10 by Microsoft.

Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles, and configurations.

Here's a demo of Windows Terminal with Cmder:

Cmder on Windows Terminal

 

Instructions

  1. Download and install Download installer

Note: Windows 11 usually comes with Windows Terminal already pre-installed.

  1. Follow the instructions in this page to set-up the %CMDER_ROOT% environmental variable
    ✍ Tip: If you already have a working environment variable, skip this step

  2. Open Windows Terminal, then press Ctrl + , (Control-Comma) to open the Settings file (settings.json).

    The settings file will be opened for edit with your default text editor program.

  3. Navigate to profiles and add the following item to the list attribute. You can place it at the top if you want cmder to be the first item in the dropdown selection window.

            {
                "guid": "{00000000-0000-0000-ba54-000000000132}",
                "commandline": "cmd.exe /k \"%cmder_root%/vendor/init.bat\"",
                "icon": "%cmder_root%/icons/cmder.ico",
                "name": "Cmder", // You can give a custom name here
                "closeOnExit": "graceful",
                "hidden": false
            },

    👉 Note: Make sure to define the environment variable before using the %CMDER_ROOT% portion.

  4. Additional configuration

    • You can make cmder the default shell-environment/profile by changing the defaultProfile attribute in the settings file to the name of cmder's profile (i.e. 'cmder) in the settings file. For example, if the nameof the cmder profile iscmder, change defaultProfile` value to:

        "defaultProfile": "cmder",

     

    • You can specify a starting directory. The default starting directory is C:\Users\username\. If you can want to change it, make the following changes:

          {     
                "guid": "{00000000-0000-0000-ba54-000000000132}",
                "commandline": "cmd.exe /k \"%cmder_root%/vendor/init.bat\"",
                "startingDirectory": "E:/Codes/", // Specify your directory of choice
                "name": "Cmder",
                "icon": "%cmder_root%/icons/cmder.ico",
                "hidden": false
          },

     

    • You can also add the Monokai-Cmder color scheme into Terminal's "schemes": []
      (source: https://atomcorp.github.io/themes/?theme=Monokai+Cmder)

        {
            "name": "Monokai Cmder",
            "black": "#272822",
            "red": "#a70334",
            "green": "#74aa04",
            "yellow": "#b6b649",
            "blue": "#01549e",
            "purple": "#89569c",
            "cyan": "#1a83a6",
            "white": "#cacaca",
            "brightBlack": "#7c7c7c",
            "brightRed": "#f3044b",
            "brightGreen": "#8dd006",
            "brightYellow": "#cccc81",
            "brightBlue": "#0383f5",
            "brightPurple": "#a87db8",
            "brightCyan": "#58c2e5",
            "brightWhite": "#ffffff",
            "background": "#272822",
            "foreground": "#cacaca",
            "selectionBackground": "#cccc81",
            "cursorColor": "#ffffff"
        },

      After that, modify the Cmder profile with "colorScheme": "Monokai Cmder", like this:

        {
            "guid": "{00000000-0000-0000-ba54-000000000132}",
            "commandline": "cmd.exe /k \"%cmder_root%/vendor/init.bat\"",
            "colorScheme": "Monokai Cmder", // Set the color scheme to "Monokai Cmder"
            "icon": "%cmder_root%/icons/cmder.ico",
            "name": "Cmder",
            "closeOnExit": "graceful",
            "hidden": false
        },

      Monokar Cmder on Windows Terminal

     

    • To use Powershell instead of the default clink shell, use the following values:

          {     
                "guid": "{00000000-0000-0000-ba54-000000000127}",
                "name": "Cmder :: Powershell",
                "commandline": "%SystemRoot%/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -NoExit -Command \"Invoke-Expression '. ''%cmder_root%/vendor/profile.ps1'''\"",
                "icon": "%cmder_root%/icons/cmder.ico",
                "colorScheme": "Monokai Cmder",
                "hidden": false
          },
  5. Configure the prompt colors: In order to change the prompt colors, modify the following file:

    %cmder_root%\config\cmder_prompt_config.lua
    
    uah_color = "\x1b[1;33;49m" -- Green = uah = [user]@[hostname]
    cwd_color = "\x1b[1;32;49m" -- Yellow cwd = Current Working Directory
    lamb_color = "\x1b[1;30;49m" -- Light Grey = Lambda Color
    clean_color = "\x1b[1;37;49m"
    dirty_color = "\x1b[33;3m"
    conflict_color = "\x1b[31;1m"
    unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color

    For more customizations, please see Customization.

    👉 Note: The default prompt colors might produce an ugly black background in your acrylic theme, such as below:
    This is due to use of SGR40 color code instead of SGR49 in the above provided config. Using the values provided above will fix the issue.

Optional Steps

Default terminal application

If you're on Windows 11, you can set Microsoft Terminal as the default Terminal app on windows, so even if you type cmd.exe in the run menu, the new terminal app will open instead (reference).

Then, together with the Default profile option set to Cmder, you can get the behavior you're looking for in a more modern and safe way.

  1. Press Ctrl + , (Control-Comma) to access Terminal Settings
  2. Set the Default terminal application to Windows Terminal
  3. Click Save

With this mechanism, you can take use of the Win + X keys to open the terminal quickly.


This guide was developed from issue #2121

More information:

Demo

Windows Terminal Cmder

Default Cmder (with ConEmu)