• Stars
    star
    707
  • Rank 64,036 (Top 2 %)
  • Language
    Lua
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Custom prompt for Cmder on Windows

Status (Dec. 2022)

Sometime in 2019, I've switched from Windows to Linux and stopped using Cmder on daily basis.
Since the new Windows Terminal became available, I've also stopped using Cmder on my work machine.
This project is no longer updated.
For an alternative, check out oh-my-posh
For a Cmder alternative, please read the Status and Contributions section and check out the pull requests and the list of forks
Thank you all!

Cmder-powerline-prompt

This is a custom prompt for Cmder (the alternative console emulator for Windows). There's also a PowerShell version of this prompt.
It looks like this:
screenshot

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.

The look is inspired by Powerline for Vim, and Zsh's theme agnoster.

Requirements

Download the AnonymousPro font
You'll be able to use any font in Cmder, but this font contains the symbols included in the prompt.

Font

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: E0A0; E0B0;
    • for extra symbols set in _powerline_config.lua (like npm logo for node module or git project for smart path resolving) set the Alternative font to one of your choosing. screenshot
    • The Icomoon includes npm and git symbols. You might find nerd-fonts helpful as well.
  • Save Settings

Setup

Download the .lua files, and place it in %CMDER_ROOT%/config folder.
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 .lua file.

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 _powerline_config.lua.sample

To add symbolic links across drives (from C drive pointing to D drive, for example), use PowerShell instead of mklink.

new-item -path powerline_core.lua -itemtype symboliclink -value <path to repo folder>\cmder-powerline-prompt\powerline_core.lua

Configuration

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: _powerline_config.lua.sample

See the file _powerline_config.lua.sample for full list and details of configurations.

Helpful info for customizing Cmder

Links

Cmder Source Code and README
What is Clink
Clink Lua API
ANSI Color Sequence

Cmder Configurations

Cmder configurations is stored in %CMDER_ROOT%\config\
You can add files to be loaded during startup in either of these folders
%CMDER_ROOT%\config\profile.d
%CMDER_ROOT%\config
Add a .ps1 file to be loaded for Powershell shells
Add a .bat or .cmd files to be loaded for Windows Command shells
Add a .sh file to be loaded for Bash shells
User-specific configurations should go into files named user-profile with extensions ps1, cmd/bat, or sh.

Clink Prompt

The file %CMDER_ROOT%\vendor\clink.lua sets the command prompt. See the function set_prompt_filter. 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.

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.

More Repositories

1

WindowsContextMenuCustomizations

Registry entries to modify Windows context menu
PowerShell
100
star
2

cmder-powershell-powerline-prompt

Custom PowerShell prompt for Cmder on Windows
PowerShell
98
star
3

AlternativesToOnlineServices

A list of alternatives to online services.
80
star
4

WindowsCustomizations

Registry entries to customize Windows
PowerShell
20
star
5

awesome-gis

Collection of GIS Resources
JavaScript
13
star
6

JsapiTypescriptSamples

ArcGIS Javascript API Samples written in Typescript
TypeScript
8
star
7

RealTimeGisWithSignalR

Sample for how to integrate SignalR with Esri JSAPI to offer realtime map editing
JavaScript
6
star
8

agol-schemas

JSON Schemas for ArcGIS Online's REST API responses
JavaScript
6
star
9

DevDiary

Collection of small daily problems and how I solved them
5
star
10

agol-swagger

Swagger spec for ArcGIS Online's REST API
JavaScript
5
star
11

agol-data-faker

Generate fake responses from ArcGIS Online's REST API
JavaScript
4
star
12

LinuxInstallScripts

Install Scripts of My Linux PC
Shell
4
star
13

AMapOfIceAndFire

Travel through the Known World of Westros
JavaScript
4
star
14

Windows10BuiltInApps

PowerShell scripts to uninstall and install Windows 10 built-in apps
PowerShell
3
star
15

WoxPluginKeyboardShortcuts

Wox Plugin to quickly search for Keyboard Shortcuts
C#
3
star
16

Shepherd

An ArcCatalog-Style alternative to ArcGIS Server Services Directory
JavaScript
3
star
17

HIFlows

HI Flows charts the discussions of the 'Hello Internet' podcast
JavaScript
3
star
18

askdeveloper-site

Website for the AskDeveloper podcast
CSS
2
star
19

agol-swagger-codegen-js

JavaScript client of ArcGIS REST API automatically generated using agol-swagger
JavaScript
2
star
20

getEsriJson

Simple tool to get Esri JSON from of drawn Graphics
HTML
2
star
21

amreldib.github.io

Blog has been moved to https://gitlab.com/AmrEldib/amreldib.gitlab.io The blog is at https://amreldib.com Github home is at https://amreldib.github.io/
CSS
2
star
22

FunWithTurf

Some fun exercises with Turf.js
JavaScript
2
star
23

ags-shepherd

JavaScript
1
star
24

StartupHelper

Tiny Windows Utility to Create Startup Profiles
C#
1
star
25

fake-agol

Node.js Server that simulates ArcGIS Online REST API
JavaScript
1
star
26

AgentHelper

AgentHelper is a utility that helps show status of Cisco Agent in the System Tray.
C#
1
star
27

agol-endpoints

UI for making requests to ArcGIS Online's REST endpoints
1
star
28

dotfiles

Collection of dotfiles
Shell
1
star