GithubHelp home page GithubHelp logo

martinsgill / oh-my-posh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jandedobbeleer/oh-my-posh2

0.0 3.0 0.0 154 KB

A prompt theming engine for Powershell running in ConEmu

License: MIT License

PowerShell 100.00%

oh-my-posh's Introduction

oh-my-posh

Build status Coverage Status Gitter PS Gallery

Table of Contents

About

A theme engine for Powershell in ConEmu inspired by the work done by Chris Benti on PS-Config and Oh-My-ZSH on OSX and Linux (hence the name).

More information about why I made this can be found on my blog.

Theme

Features:

  • Easy installation
  • Awesome prompt themes for PowerShell in ConEmu
  • Git status indications (powered by posh-git)
  • Failed command indication
  • Admin indication
  • Current session indications (admin, failed command, user)
  • Configurable
  • Easily create your own theme
  • Separate settings for oh-my-posh and posh-git
  • Does not mess with the default Powershell console

Prerequisites

You should use ConEmu to have a brilliant terminal experience on Windows. You can install it using Chocolatey:

choco install ConEmu

The fonts I use are Powerline fonts, there is a great repository containing them. I use Meslo LG M Regular for Powerline Nerd Font in my ConEmu setup together with custom colors. You can find my theme here.

Installation

You need to use the the PowerShell Gallery to install oh-my-posh.

Install posh-git and oh-my-posh:

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

Configuration

List the current configuration:

$ThemeSettings

Theme

You can tweak the settings by manipulating $ThemeSettings. This example allows you to tweak the branch symbol using a unicode character:

$ThemeSettings.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0xE0A0)

Also do not forget the Posh-Git settings itself (enable the stash indication for example):

$GitPromptSettings

Helper functions

Set-Theme: set a theme from the Themes directory. If no match is found, it will not be changed. Autocomplete is available to list and complete available themes.

Set-Theme paradox

Show-ThemeColors: display the colors used by the theme

Theme

Show-Colors: display colors configured in ConEmu

Theme

Themes

Agnoster

Agnoster Theme

Paradox

Paradox Theme

Sorin

Sorin Theme

Darkblood

Darkblood Theme

Avit

Avit Theme

Honukai

Honukai Theme

Fish

Fish Theme

Creating your own theme

If you want to create a theme it can be done rather easily by adding a mytheme.psm1 file in the folder indicated in $ThemeSettings.MyThemesLocation (the folder defaults to ~\Documents\WindowsPowerShell\PoshThemes, feel free to change it).

The only required function is Write-Theme. You can use the following template to get started:

#requires -Version 2 -Modules posh-git

function Write-Theme
{
    param(
        [bool]
        $lastCommandFailed,
        [string]
        $with
    )

    # enter your prompt building logic here
}

$sl = $global:ThemeSettings #local settings

Feel free to use the public helper functions Get-VCSStatus, Get-VcsInfo, Get-Drive, Get-ShortPath, Set-CursorForRightBlockWrite, Save-CursorPosition, Pop-CursorPosition, Set-CursorUp or add your own logic completely.

To test the output in ConEmu, just switch to your theme:

Set-Theme mytheme

If you want to include your theme in oh-my-posh, send me a PR and I'll try to give feedback ASAP.

Happy theming!

Based on work by

oh-my-posh's People

Contributors

alirobe avatar amedee avatar bdukes avatar fornever avatar jandedobbeleer avatar janjoris avatar martinsgill avatar nwykes avatar vladimir-poleh avatar wcernst avatar

Watchers

 avatar  avatar  avatar

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.