All Projects → JanDeDobbeleer → Oh My Posh2

JanDeDobbeleer / Oh My Posh2

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

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to Oh My Posh2

Bumblebee Status
bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
Stars: ✭ 780 (-84.54%)
Mutual labels:  powerline, hacktoberfest
powerless
Minimalistic/responsive ZSH prompt inspired by powerline.
Stars: ✭ 63 (-98.75%)
Mutual labels:  powerline, agnoster
Themer
themer is inspired by trevordmiller/nova and chriskempson/base16.
Stars: ✭ 4,483 (-11.16%)
Mutual labels:  hacktoberfest, conemu
Website
The train engine powering the Coding Train website
Stars: ✭ 5,313 (+5.29%)
Mutual labels:  hacktoberfest
Beehive
A flexible event/agent & automation system with lots of bees 🐝
Stars: ✭ 5,348 (+5.98%)
Mutual labels:  hacktoberfest
Opsdroid
🤖 An open source chat-ops bot framework
Stars: ✭ 563 (-88.84%)
Mutual labels:  hacktoberfest
Awesome Micro Frontends
An Awesome list of posts, videos and tutorials on Micro Frontends
Stars: ✭ 570 (-88.7%)
Mutual labels:  hacktoberfest
Pushbullet.py
A python client for http://pushbullet.com
Stars: ✭ 555 (-89%)
Mutual labels:  hacktoberfest
Pyrdp
RDP man-in-the-middle (mitm) and library for Python with the ability to watch connections live or after the fact
Stars: ✭ 567 (-88.76%)
Mutual labels:  hacktoberfest
C
Implementation of All ▲lgorithms in C Programming Language
Stars: ✭ 559 (-88.92%)
Mutual labels:  hacktoberfest
Pezor
Open-Source PE Packer
Stars: ✭ 561 (-88.88%)
Mutual labels:  hacktoberfest
Cataclysm Dda
Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
Stars: ✭ 5,894 (+16.81%)
Mutual labels:  hacktoberfest
Typeofnan Javascript Quizzes
JavaScript quiz questions and explanations!
Stars: ✭ 566 (-88.78%)
Mutual labels:  hacktoberfest
Cockpit
Add content management functionality to any site - plug & play / headless / api-first CMS
Stars: ✭ 5,173 (+2.52%)
Mutual labels:  hacktoberfest
Introviews Flutter
☀️ A Flutter package for some material design app intro screens with some cool animations.
Stars: ✭ 570 (-88.7%)
Mutual labels:  hacktoberfest
Hello World
Hello World in all possible programmnig languages
Stars: ✭ 558 (-88.94%)
Mutual labels:  hacktoberfest
Opennms
Enterprise-Grade Open-Source Network Management Platform
Stars: ✭ 568 (-88.74%)
Mutual labels:  hacktoberfest
Rust Rosetta
Implementing Rosetta Code problems in Rust.
Stars: ✭ 563 (-88.84%)
Mutual labels:  hacktoberfest
Controlzex
Shared Controlz for WPF and ... more
Stars: ✭ 561 (-88.88%)
Mutual labels:  hacktoberfest
Mtproto
Full-native go implementation of Telegram API
Stars: ✭ 566 (-88.78%)
Mutual labels:  hacktoberfest

oh-my-posh

Build status Travis build status Coverage Status Gitter PS Gallery

Support

Patreon Liberapay Ko-Fi

Introducing V3 and what it means for V2

It's been an amazing ride for Oh myPosh, but the time has come to step it up a notch. Developers nowadays no longer stick to one shell/language, they are all tools we use to solve a certain problem. The same needs to apply to Oh my Posh. It's time to adjust to that philosophy.

That's why this version of Oh my Posh is entering maintenance mode while I'm working hard on getting V3 out of the door. Given that V3 is entirely different under the hood, it's hosted separately for now. From a user perspective, it should give the same experience out-of-the-box, with the added advantage that custom themes are a first class, no code citizen.

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

Documentation is also available which should give a better experience than this README has over the past few years :-)

If you're a developer looking to add functionality, please have a look at V3 to see if it already exists there. If not, feel free to create an issue or PR on V3, I will only be accepting bug fixes on V2 from now on.

Table of Contents

About

A theme engine for Powershell 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 a modern console host like ConEmu, Alacritty, Terminus, Hyper, FluentTerminal, or the official Windows Terminal to have a great terminal experience on Windows.

There are multiple ways to acquire Windows Terminal - from the Microsoft Store, the GitHub repo, or the below commandline methods:

Via WinGet (official package manager for Windows):

winget install --id=Microsoft.WindowsTerminal -e

Via Chocolatey:

choco install microsoft-windows-terminal

Via Scoop:

scoop install windows-terminal

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.

In case you notice weird glyphs after installing a font of choice, make sure the glyphs are available (maybe they have a different location in the font, if so, adjust the correct $ThemeSettings icon). If it turns out the character you want is not supported, select a different font.

Installation

You need to use 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

Enable the prompt:

# Start the default settings
Set-Prompt
# Alternatively set the desired theme:
Set-Theme Agnoster

In case you're running this on PS Core, make sure to also install version 2.0.0-beta1 of PSReadLine

Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck

To enable the engine edit your PowerShell profile:

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE

Append the following lines to your PowerShell profile:

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox

The last command sets the theme for the console. Check the available themes list below.

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

Hide your username@domain when not in a virtual machine for the Agnoster, Fish, Honukai, Paradox and Sorin themes:

$DefaultUser = 'yourUsernameHere'

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

Robbyrussell

Robbyrussell Theme

Pararussel

Pararussel Theme

Material

Material Theme Material Theme

Star

Star Theme

Zash

Star Theme

Lambda

Lambda Theme

Emodipt

Emodipt Theme

Operator

Operator 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-FormattedRootLocation, Get-ShortPath, Set-CursorForRightBlockWrite, Set-CursorUp, Set-Newline 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!

Adding stack count to a custom theme

As it seems getting access to the stack information when using pushd/popd is sort of mission impossible from within a theme, you can use a workaround proposed by Jonathan Leech-Pepin. In your $PROFILE, add a variable that will act as a correctly scoped pointer to fetch the stack context:

$getStackContext = {Get-Location -Stack}

Next, in your custom theme, access the information you want to display:

$stackCount = (&$getStackContext).count

iTerm2 is creating notifications every time

This is caused by the ConsoleTitle functionality. As explained by Andrew Stanton-Nurse it's linked to how terminals work with OSC codes. The fix is to disable the ConsoleTitle functionality when in iTerm2 by adding the following snippet to your $PROFILE.

if($env:LC_TERMINAL -eq "iTerm2") {
    $ThemeSettings.Options.ConsoleTitle = $false
}

Based on work by

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].