The prompt has multiple segments:
- Folder: in blue. Displays the folder name, or full path. Replaces the user's home folder with a tilde (~).
- npm: in teal. If it detects an npm package, it displays the package name and version number.
- Git: in green or yellow. If it detects a Git repo, it displays the branch name. A green color is used if no changes are detected. A yellow color is used if changes are found.
In the screenshot, Fira Code font is used.
Download the AnonymousPro font
You'll be able to use any font in Cmder, but this font contains the symbols included in the prompt.
To use another font and still show symbols correctly:
- Go to Cmder Settings > Main
- Choose Main console font to be what you prefer
- Choose Alternative font to be Anonymice Powerline
- Modify the value of Unicode ranges to add:
- Save Settings
.lua files, and place it in
Restart Cmder to load the prompt.
Alternatively, if you want to maintain link with the original repo, you can clone this repo into any folder
git clone https://github.com/AmrEldib/cmder-powerline-prompt.git git-repo-folder-name
then create a symbolic link from the
%CMDER_ROOT%/config folder to the
cd %CMDER_ROOT%/config mklink /H powerline_core.lua <git-repo-folder-name>/powerline_core.lua mklink /H powerline_prompt.lua <git-repo-folder-name>/powerline_prompt.lua
To add Git prompt, add the Git file
mklink /H powerline_git.lua <git-repo-folder-name>/powerline_git.lua
To add Configurations, create a file named
_powerline_config.lua that is a copy of the file
To add symbolic links across drives (from C drive pointing to D drive, for example), use PowerShell instead of
new-item -path powerline_core.lua -itemtype symboliclink -value <path to repo folder>\cmder-powerline-prompt\powerline_core.lua
Config file is
_powerline_config.lua. This file isn't created by default to avoid overwrite on future updates.
A sample config file is included:
See the file
_powerline_config.lua.sample for full list and details of configurations.
Helpful info for customizing Cmder
Cmder configurations is stored in
You can add files to be loaded during startup in either of these folders
.ps1 file to be loaded for Powershell shells
.cmd files to be loaded for Windows Command shells
.sh file to be loaded for Bash shells
User-specific configurations should go into files named
user-profile with extensions
%CMDER_ROOT%\vendor\clink.lua sets the command prompt. See the function
The prompt value is stored in clink.prompt.value
Drop .lua files into the
%CMDER_ROOT%\Config folder to customize the prompt.
Status & Contributions
I published this code because it's not nice to keep it to myself. I fix problems that I encounter, and try to fix problems that others encounter if I have time.
This code is provided with the timeless Works on my Machine guarantee.
You can also check out the pull requests page for contributions that didn't make back into this repo. These are fixes to problems I didn't encounter, or features not useful to me, but maybe useful to you.
Some of these contributions are:
People are very kind and contribute back fixes and improvements.
This section is to acknowledge their contributions and thank them. If you find their contributions helpful to you, please take the time to thank them directly.
- omniphx #2
- umar-ahmed #6
- tvercruysse #10
- igortg #24
- 0NG #27
- mattdkerr #29
- ivanjonas #32
- sp3c1 contributed the npm addon #33
- Bob Hood contributed the new Mercurial addon #40
I'd like to thank all who share their code with everyone for their time and effort.
Writing an addon
This prompt uses an addon architecture to allow for additional functionality.
powerline_prompt.lua is a good example for how to write an addon. The code is annotated and explains how to write a new addon.
To write a new addon, create a new
lua file in
%CMDER_ROOT%/config. Start a new tab in Cmder to see the effect of changes.