igortg / cmder-powerline-prompt

Custom prompt for Cmder on Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cmder-powerline-prompt

This is a custom prompt for Cmder (the alternative console emulator for Windows).

Changes of this Fork:

  • Support for virtual environments
  • Minor changes on color configs

screenshot

Installing and Configuring (for Windows Terminal)

  1. Download the .lua file, and place it in %CMDER_ROOT%/config folder.
  2. Open the Windows Terminal
  3. Go to Settings (Ctrl+,)
  4. Open the Settings as JSON file (Open JSON File button on the bottom-left)
  5. Add the following JSON entry under "profiles:list" (replace C:\\tools\\cmdermini with %CMDER_ROOT% folder):
{
    "commandline": "cmd /k C:\\tools\\cmdermini\\vendor\\init.bat",
    "icon": "C:\\tools\\cmdermini\\icons\\cmder_green.ico",
    "name": "Cmder",
    "hidden": false,
},     
  1. Save the settings.json file and get back to Windows Terminal
  2. On the Startup section, set Cmder as the default profile (optional)

Changing the Font

A font with ligatures is required so special symbols are shown correctly. The following fonts from Nerd Fonts were tested:

  • FiraCode
  • GeistMono
  • Ubuntu Mono

After installing the selected font (just extract the ZIP and righ-click on the .ttf files), go to Windows Terminal settings, select the Cmder profile, scroll to the Appearance and pick the font on the Font Face option.

Customization

You can modify the prompt to display either the full path or only the folder name.
To do this, modify the value of the promptValue variable in the powerline_prompt.lua file at this line
The value could be either:

  • promptValueFull for full path like C:\Windows\System32
  • promptValueFolder for folder name only like System32

promptValueFull is the default.

Helpful info for customizing Cmder

Links

Cmder Source Code and README
What is Clink
Clink 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 & Contribution

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 gurentee.
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.

People are very kind and contribute back fixes and improvements.
This section is to acknowledage 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.

About

Custom prompt for Cmder on Windows


Languages

Language:Lua 100.0%