Skip to content
David Refoua edited this page Jul 5, 2023 · 38 revisions

 



Cmder Customization Guide
A curated list by the community

This page will explain how you can modify the look and different behaviors of Cmder to your needs.
By the way, You can ✨ contribute to this page too!

📜 Table of contents

Legend

name description
👉 Note: This is an important note to follow
👉 Tip! This is a suggestion or a reminder
TODO: Describes an incomplete section
TBA To be added section

 

Attention

  • The configuration files and modifications need to be placed in the [cmder_root]\config directory.
    Do not edit the files in the [cmder_root]\vendor directory, as they will get overwritten on each Cmder update.
  • Make sure you update to the latest version of Cmder before applying customizations to your shell. The customization guide below only works with the recent versions of Cmder, older versions do not include the required files for configuration.

 

Shells

Cmder can run a variety of different shell profiles (e.g. bash, cmd and powershell).

When you open Cmder, the default cmd shell is displayed. If you're using another shell, you need to also configure it to your liking.

 

Cmd/Clink

The shell for cmd is enhanced by the enhanced fork of Clink and clink-completions that are included in your Cmder package.

We will explain how you will be able to change properties such as the prompt text, color, and auto-answer to Ctrl-C behavior.

👉 Note: Clink uses a programming language -- called Lua -- in order to store its configuration files. You can read the manual to learn the syntax, if you are interested.

If you are a power user, you can also take a look at Configuring Clink, which goes into great detail to explain how you can customize Clink to your exact needs. It's a pretty neat component of Cmder!

Prompt customization

The default prompt text and color are defined in the the vendor directory here and should not be modified.

In order to make persistent changes across updates, you'll need to edit the clink profile file at the following path:

%cmder_root%\config\cmder_prompt_config.lua

For example, if you have nano text editor installed on your machine (included in the Cmder Full version), type this to create or open the file:

λ nano %cmder_root%\config\cmder_prompt_config.lua

👉 Tip! If you don't have the nano editor (or are not comfortable using it to edit your files), feel free to substitute it with your editor of choice (e.g. code for VS Code or notepad for Notepad, or even vim).

The full edition of the Cmder includes nano editor as part of git for Windows. You can of course also install nano separately, or use a different text editor altogether, such as neovim.

👉 Tip! Hit Ctrl + F (using VS Code or Notepad) or Ctrl + W (using Nano) to find each entry.

Same-line current working directory

Turn this option on to show the entire prompt in one line, as opposed to different lines for displaying the current directory and the prompt.

Example:

prompt_singleLine = true

Demo

Prompt Color

The color is controlled by escape sequences, which is written as ESC [ <number> ; <number> ; ... m in the documentation, or \x1b[ nnn m in our clink.lua file.

For example, \x1b[1;32;40m will display a green text. Each number can be prepended using a semicolon ; in order to add to the text style (e.g. codes 30-37 set the foreground text color, codes 40-47 set the background color, code 1 makes the text bold. So 31;47;1 produces a red text in white background in bold).

If you change 32 to 36, you'll get a cyan path:

cmder-cyan

If you change 32 to 33, you'll get a yellow path:

cmder-yellow

List of colors

Color Foreground Background Bright Foreground Bright Background
Black 30 40 90 100
Red 31 41 91 101
Green 32 42 92 102
Yellow 33 43 93 103
Blue 34 44 94 104
Magenta 35 45 95 105
Cyan 36 46 96 106
White 37 47 97 107

List of effects

Code Effect Description
0 Reset / Normal Turns off all styles and produces a normal prompt
1 Bold Display text in bold or increased intensity
2 Dim Terminal-dependant; shows text with lighter colors or decreased intensity
3 Italic Display text in italic
4 Underline Display text with underline
7 Reverse Swap the colors of background and foreground

👉 Tip! You can chain multiple color codes using the semicolon character, e.g. 1;31;40 will produce a bold text in red on a black background.

Read this page for a complete list of colors.

For further customization, have a look at this comment.

Here are the default color codes:

-- Prompt Element Colors
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[37;1m"
dirty_color = "\x1b[33;3m" -- Yellow, Italic
conflict_color = "\x1b[31;1m" -- Red, Bold
unknown_color = "\x1b[37;1m" -- White = No VCS Status Branch Color

👉 Tip! The color code 40 will produce a black background, click here for more details. Use color code 49 for transparent background color.

Prompt Symbol

You can change the lambda λ to any custom UTF-8 character by modifying the lambda variable in your lua script.

Then replace it with the default symbol, like this:

prompt_lambSymbol = ""
cmder_shell_symbol

👉 Note: Make sure both your terminal emulator (e.g. ConEmu) and your font (e.g. Consolas) can support and display your character.

We recommend using Windows Terminal, Hyper, Terminus or FluentTerminal as your terminal emulator and either Fira Code, Hasklig or Source Code Pro as your font.

Do you prefer any other font such as Cascadia Code or JetBrains Mono? Edit this wiki and add your favorite fonts here!

Clink auto answer

You can configure Cmder to automatically answer Cmd.exe messages.

The settings file for the shell is located here:

[cmder_root]\config\clink_settings

For example, if you have nano text editor installed on your machine, type this to create or open the file:

λ nano %cmder_root%\config\settings

👉 Tip! As always, you can use a different text editor (such as notepad) instead of nano.

Terminate batch job (Y/N)?

Method 1: Add for the following subsection:

# name: Auto-answer terminate prompt
# type: enum
# options: off,answer_yes,answer_no
cmd.auto_answer = answer_yes

– OR –

Method 2: Enter the following into your Cmder shell:

clink set cmd.auto_answer answer_yes 

Which outputs:

Setting 'cmd.auto_answer' set to 'answer_yes'

👉 Note: Restart Cmder session to take effect, if required.

Source: @edmundo096
See also: #108, #1666 and this stackoverflow post.

Using ~ as the home directory

TODO: 👉 Tip! How to use ~ (tilde) for home directory

Update: Cmder has more information in this issue: Use ~ for User's Home directory

A solution to make cd ~ work in Cmder: here

 

Powershell

TODO: TBA.

👉 Tip! For PowerShell customization, follow this link. Also, check out cmder-powerline-prompt.

Bash

TODO: TBA.

👉 Tip! How to add λ to the bash shell and cygwin

Bash Prompt Symbol

You can change the lambda λ symbol for the bash shell prompt by creating/editing the ~/.config/git/git-prompt.sh file.

If it's empty (or non-existent) firstly open the default bash prompt file from here, find the first line containing PS1= and copy all lines from that line to the last line containing PS1= you see (right before the fi statement).

Then adjust the PS1="$PS1"'λ ' line to your liking, and save it.

More information: https://github.com/cmderdev/cmder/blob/master/vendor/git-prompt.sh

Window

This section explains customizations related to the terminal window (e.g. icon, transparency, acrylic blur, etc)

Icons

Cmder package includes 6 rainbow-colored icons in addition to the default icon.

cmder_colors

The icons are available in the icons folder:

[cmder_root]\icons\cmder_*.ico

You can choose one for the Cmder shortcut.

To do so, right-click on the shortcut file, from PropertiesShortcutChange Icon... open and select the new cmder icon.

Terminal emulators

Cmder is a terminal package that includes ConEmu as the underlying terminal emulator, and different shell profiles.

You can replace ConEmu with different terminal emulators, such as Hyper, Terminus or FluentTerminal.

Hyper Cmder

Hyper is a terminal emulator built with web-technologies such as xterm.js and Electron. Read more…

Cmder on Hyper

Fluent Terminal

Fluent Terminal is a terminal emulator built with UWP and xterm.js. It is GPU-accelerated and uses web-technologies.

Here's how the acrylic blurred-behind looks:

This effect is achieved using FluentTerminal integration.

Cmder on FluentTerminal UWP, a transparent terminal for Windows with acrylic effect

Color schemes

👉 Note: The following color schemes are made for the ConEmu terminal emulator. Other terminal emulators (such as Hyper, Terminus and Fluent Terminal) use different scheme formats.