Windows Terminal and Cmder#

Using windows to develop can be a bit of a challenge. It doesn’t have any good tools for cross-platform python tools. On Linux, I use make and a makefile to orchestrate building and configuring virtual environments. Clone the repo and make venv and I have a functional and repeatable environment. A few months ago I discovered Cmder. I learned that it has make and most of the tools I use out of the box for windows. The only issue, it is a bit of a pain. Recently I decided to try installing windows terminal and host Cmder in that. That works really well and seems to be pretty stable and is relatively easy to install. It would be nicer if it was an automated install, but these instructions are not too bad.

Reference: https://medium.com/talpor/windows-terminal-cmder-️-573e6890d143

Download:

Install Cmder#

Extract the contents of the Cmder zip archive to a folder. I usually have a folder in the root of the drive called tools. I’ll put it here:

C:\tools\cmder

Configure Environment Variables#

Configure the following environment variables:

CMDER_ROOT
C:\tools\cmder

ConEmuDir
C:\tools\cmder\vendor\conemu-maximus5

Verify they are correct by using the Windows + R shortcut and typing %CMDER_ROOT% or %ConEmuDir%. It should open windows explorer in the correct folder.

Note

The paths should point to the location on your system.

Setting up Cmder#

Launch Cmder and go to settings/environment. Add the following and save settings:

chcp utf8

Test it by running the following in the Cmder terminal:

ConEmuC -CheckUnicode
C:\
λ ConEmuC -CheckUnicode
ConEmu 210912 [32] Startup Info
  OsVer: 10.0.19043.x64, Product: workstation, SP: 0.0, Suite: 0x100
  Build: 2009, UBR: 1586, ReactOS: 0, Rsrv: 0, WINE: 0, PE: 0, R2: 0
  DBCS: 0, IMM: 1, Remote: 0, ACP: 1252, OEMCP: 437, Admin: 0
  StartTime: 2022-03-30 10:27:22.008
ConHWND=0x00200CD6, Class="ConsoleWindowClass"
GuiPID=20104, ConEmuPID=20104, ConEmuServerPID=10460
Console font info: 0, {3x5}, 54, 400, "Lucida Console"
Handles: In=x50 (Mode=x1B7) Out=x54 (Mode=x3) Err=x58 (Mode=x3)
Buffer={128,1000} Window={0,0}-{127,17} MaxSize={128,203}
Cursor: Pos={0,12} Size=25% Visible
ConsoleCP=65001, ConsoleOutputCP=65001, Layout=00000409 (failed errcode=16385)
CP65001: Max=4 Def=x3F,x00 UDef=xFFFD
  Lead=x00,x00,x00,x00,x00,x00,x00,x00,x00,x00,x00,x00
  Name="65001 (UTF-8)"

123456789也不是可运行的程序123456789
Normal Reverse Extra --> x7 x4007 x7
LVert:x0807 RVert:x1007 Extra:x2007 Under:x8007 Horz:x0407

Check AÀΑ╬豈Aꊠ黠だ➀ጀะڰЯ09
Text: AÀΑ╬豈Aꊠ黠だ➀ጀะڰЯ09
Read: A:xF À:xF Α:xF ╬:xF 豈:x10F A:x20F ꊠ:x10F 黠:x20F だ:x10F ➀:x20F ጀ:x10F ะ:x20F ڰ:x10F Я:x20F 0:xF 9:xF
Blck: A:xF À:xF Α:xF ╬:xF 豈:x10F 豈:x20F A:x10F A:x20F ꊠ:x10F ꊠ:x20F 黠:x10F 黠:x20F だ:x10F だ:x20F ➀:xF ጀ:xF ะ:x1 ڰ:x7 Я:
x7 0:x7 9:x7
Info: 87,1,1,16 1,1,27,1  Cursor={6,23}->{27,23} [+5]

Width: 128, Mid: 64, DblCell: 1
╔══════════════════════════════════════════════════════════════╦═══════════════════════════════════════════════════════════════╗
║中文                                                          ║中                                                           文║
╚══════════════════════════════════════════════════════════════╩═══════════════════════════════════════════════════════════════╝

Unicode check succeeded

Test UTF-8 Support#

Hit windows + r to launch the run dialog. Paste and run the following:

cmd /c %ConEmuDir%\ConEmu\Addons\utf-8-test.cmd

That should work and produce the correct output in the windows command prompt.

Windows Terminal#

Install Windows Terminal.

Setting up Windows Terminal#

Access the settings from the drop down in windows terminal near the tabs. At the bottom, use the menu item Open JSON file.

We’ll create a new guid, in power shell:

New-Guid

NOTE: You will need to launch a powershell terminal. You can also generate a UUID by another other method if you wish.

We’ll use that to create a new item in the list:

{
  "guid": "{473413b8-7adf-4f0c-90a7-984e8de03538}",
  "name": "Cmder",
  "commandline": "cmd.exe /k %CMDER_ROOT%\\vendor\\init.bat",
  "startingDirectory": "%USERPROFILE%",
  "icon": "%CMDER_ROOT%\\icons\\cmder.ico",
  //"background": "#2e3436",
  //"padding": "15",
  //"fontFace": "Cascadia Code",
  //"fontSize": 10
}

Note

The commented out values can be used to set things explicitly if required.

Set the default profile to match the Cmder profile:

"defaultProfile": "{473413b8-7adf-4f0c-90a7-984e8de03538}",

Launch Windows Terminal from Explorer#

Reference: https://blog.mzikmund.com/2020/01/tip-launch-windows-terminal-quickly-from-file-explorer/

In windows explorer if you type wt in the address bar and hit enter, it will launch windows terminal. To make sure that the terminal starts in that folder, modify the following in the JSON:

  "startingDirectory": ".",