Giter Club home page Giter Club logo

cmder-powerline-prompt's Introduction

Cmder - Powerline prompt for cmd shell

This is a custom configuration for Cmder. It mainly contains :

  • a custom prompt inspired by the agnoster theme
    • admin symbol on black backgound (optional - not displayed by default)
    • user@hostname on black backgound (optional - not displayed by default)
    • current directory path on blue background
    • git folders on green background for clean repo and yellow for dirty
    • npm module name and version (black background)
screenshot
with Ubuntu theme

Requirements

Download Meslo LG M font
You are able to use any font in Cmder, but this font must contain the symbols included in the prompt.

Powershell dependencies

These dependencies are required only if you use a powershell console

Install-Module oh-my-posh -Scope CurrentUser
Install-Module posh-git -AllowClobber -Scope CurrentUser
Install-Module Get-ChildItemColor -Scope CurrentUser

Font Configuration

To show symbols correctly:

  • Go to Cmder Settings => Main
  • Choose Main console font to be what you prefer
  • Choose Alternative font to be Meslo LG M For Powerline
  • Modify the value of Unicode ranges to add: E0A0; E0B0; 26A1
  • Save Settings

Usage

Download all files, and place it (or create symbolic links) in %CMDER_ROOT%/config folder.
Restart Cmder to load the custom configuration.

cmd Customizations

All these modifications require to open a new console in cmder.

Path

The prompt can display either the full path (by default) or only the folder name.
To change it, add an environment variable CMDER_CUSTOM_PROMPT_PATH_TYPE in user-profile.cmd
The value could be either:

  • full for full path display (C:\Windows\System32)
  • folder for folder name display (System32)
set CMDER_CUSTOM_PROMPT_PATH_TYPE=folder

In full path mode, the user home path is substituted by a ~ character.
For disabling this, add an environment variable CMDER_CUSTOM_PROMPT_TILDE_SUBSTITUTION in user-profile.cmd with the value false.

set CMDER_CUSTOM_PROMPT_TILDE_SUBSTITUTION=false

Admin

You can modify the prompt to display a High voltage symbol at the beginning of the prompt when the current user has admin rights (inactive by default).
To do this, add an environment variable CMDER_CUSTOM_PROMPT_DISPLAY_ADMIN in user-profile.cmd with the value true

This feature is quite slow (approximately 0.2~0.3 second)

set CMDER_CUSTOM_PROMPT_DISPLAY_ADMIN=true

User

You can modify the prompt to display the current user and hostname (inactive by default).
To do this, add an environment variable CMDER_CUSTOM_PROMPT_DISPLAY_USER in user-profile.cmd with the value true

set CMDER_CUSTOM_PROMPT_DISPLAY_USER=true

Debug

The script debug.lua displays the time passed in each lua function called.
To active this script, add an environment variable CLINK_PROMPT_DEBUG with the value true

set CLINK_PROMPT_DEBUG=true

powershell Customizations

Theme

You can change the prompt theme by modifying the line Set-Theme <themeName> with the desired theme in my-user-profile.ps1.
List of available themes oh-my-posh

User

You can modify the prompt to display the current user and hostname.
To do this, comment the line $DefaultUser = $env:USERNAME in my-user-profile.ps1

Links

ANSI Color Sequence

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.