WindowsTerminal/Windows ComEmu

From Ever changing code
Jump to navigation Jump to search

ComEmu defaults key bindings

  • Apps + left/right - move between Windows/regions
  • Apps + Shift + - resize window/region
  • Ctrl + Win + Enter - maximize ConEmu window and hide window caption (FullScreen mode)
  • Ctrl + Tab, Ctrl+Shift+Tab - tabs switching, when lazy tab switching was started in recent mode, You may use Left and Right keys to select tabs directly
  • Win + 09 - activates consoles by numbers (1,2,3,4,5,6,7,8,9,0)
  • Win + W - create new console tab. Confirmation dialog will be displayed, when ‘Create confirmation’ setting is enabled
  • Win + Q, Win+Shift+Q - activate next/previous console tab
  • Win + Del - terminate current console
  • Win + S - duplicate tab with current state of root process.
  • Win + X - create new console tab with cmd.exe or some selected task. Linux subsystem in mine setup.
  • Apps + R - rename current tab. In the current ConEmu version Far Manager editors/viewers can not be renamed
  • Apps + F - search text in the console
  • Win + Alt + P - settings

ConEmu different shells

Bash on Windows (WSL)

Enable Windows Linux Subsystem

At Build 2016 Microsoft announced that Bash will be coming to Windows 10 via the future release of the Anniversary update. Made possible through the partnership of Microsoft & Canonical, this first class experience is made available natively a Windows desktop and required no VM to be run. The Windows Subsystem for Linux (WSL) is actually infrastructure within Windows operating a genuine Ubuntu user-mode Ubuntu image.

# open powershell as Administrator
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Run ConEmu with Bash shell

Run from cmd/star menu/powershell. It requires newer version of ConEmu, that runs WSL via wslbridge.exe where {bash} is a default task. This version has fixed bug where the arrow keys do work now.

ConEmu64.exe -basic -run {bash}

Get arrows working in ConEmu

This solution is only for Bash on Windows (WSL). Due to the bug BashOnWindows#111 arrows may not be working in some cases if you start just a bash.exe.

StatusBar’s Terminal modes

RightClick on the StatusBar and enable Terminal modes column. Click on X located on the StatusBar it should be between [+] NUM X PRI and select XTerm and AppKeys when tab with Bash on Windows is active.

Explanation

When XTerm mode is turned on, ConEmu posts into the console input buffer ANSI sequences instead of native Windows key-codes. For example, Linux application expect to receive ^[[A instead of VK_UP.

However there are two notations, and some applications turns on App Keys mode to receive ^[OA instead of ^[[A. That is the problem, because without wslbridge ConEmu doesn’t receive the request to change the mode!

So, if keys are not working properly, it may mean that application expects another mode of App Keys. The solution is simple: just LeftClick the Terminal modes StatusBar column and change AppKeys mode.

Disable bell

To disable tab completion bell: edit /etc/inputrc

set bell-style none


WSL

Updates to WSL itself are automatically available through Windows Update, thus Windows build number is your WSL version.

cmd.exe /c "systeminfo" | findstr "Version"
OS Version:                10.0.18362 N/A Build 18362

cmd.exe /c "systeminfo" | grep "^OS Version"
OS Version:                10.0.17763 N/A Build 17763


Wsl distro setup.

# Usage: wsl.exe [Argument] [Options...] [CommandLine]
# If no 'command line' is provided, wsl.exe launches the default shell

wsl.exe -s <DistributionName> # long option: -setdefault
wsl.exe -l --all              # --list
wsl.exe -d <DistributionName> # --distribution
wsl.exe -u <UserName>         # --user, run as the specified user

WSL2

WSL2 uses the Hyper-V Platform which does run on Home, not Hyper-V the Enterprise-grade VM hosting solution that's only in Pro SKU's and above.


Install wsl2

# Enable Windows Subsystem for Linux
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

# Enable the 'Virtual Machine Platform' optional component
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

# Set a distro to be backed by WSL 2 using the command line
wsl --set-version <Distro> 2 # supports upgrading to v2 and downgrading to v1

# Optional set wsl2 as a default architecture
wsl --set-default-version 2

# Install Ubuntu 20.04
wsl --install --distribution Ubuntu-20.04

# Verify wsl versions and distributions
wsl --list --verbose or wsl -l -v


Requirmens:

  • For x64 systems: Version 1903 or higher, with Build 18362 or higher.

WSL2 uses the Hyper-V Platform which does run on Home, not Hyper-V the Enterprise-grade VM hosting solution that's only in Pro SKU's and above.

References

References

Blogs

History