Giter Club home page Giter Club logo

jandedobbeleer / oh-my-posh Goto Github PK

View Code? Open in Web Editor NEW
14.2K 71.0 2.2K 17.26 MB

The most customisable and low-latency cross platform/shell prompt renderer

Home Page: https://ohmyposh.dev

License: MIT License

Go 63.86% PowerShell 2.01% Shell 1.24% Inno Setup 0.11% Dockerfile 0.23% Lua 0.63% HCL 0.01% JavaScript 1.80% CSS 0.95% Elvish 0.07% Python 0.06% Nushell 0.12% MDX 28.91%
golang powershell zsh hacktoberfest prompt prompt-toolkit bash cmd fish fish-shell

oh-my-posh's Introduction

Oh My Posh logo – Prompt theme engine for any shell

MIT license badge

Build Status badge

Release version number badge

Documentation link badge ohmyposh.dev

Number of GitHub Downloads badge

This repo was made with love using GitKraken.

GitKraken shield

Join the community

Mastodon badge

Discord badge

What started as the offspring of oh-my-posh2 for PowerShell resulted in a cross platform, highly customizable and extensible prompt theme engine. After 4 years of working on oh-my-posh, a modern and more efficient tool was needed to suit my personal needs.

❤️ Support ❤️

Swag - Show your love with a t-shirt!

GitHub - One time support, or a recurring donation?

Ko-Fi - No coffee, no code.

Features

  • Shell and platform agnostic
  • Easily configurable
  • The most configurable prompt utility
  • Fast
  • Secondary prompt
  • Right prompt
  • Transient prompt

Documentation

Documentation

Reviews

Thanks

oh-my-posh's People

Contributors

allcontributors[bot] avatar asherber avatar bend-n avatar cdonnellytx avatar codexlink avatar dependabot[bot] avatar ehawman-rosenberg avatar estruyf avatar felpel avatar icy-comet avatar ivan-the-terrible avatar jandedobbeleer avatar jedwillick avatar jos3s avatar khaos66 avatar lewis-yeung avatar lnu avatar markbullplus avatar memcpy-rand-rand-rand avatar mr-vipi avatar nickcraver avatar nwykes avatar sectorogo avatar tillig avatar tiwahu avatar tomkerkhove avatar tradiff avatar vedantmgoyal9 avatar warrenbuckley avatar wozjac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oh-my-posh's Issues

Long lines that wrap in terminal cause a background "highlight" on the next line

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

If you have a prompt that ends up wrapping to the next line and then ending, the next line will have a background color that matches the background of the segment at the end of the previous line.

Put another way:

  • Two line prompt - first line wraps to the second line.
  • First line ends with a color, say blue.
  • Second line ends a few characters in and the remainder of the second line is the same blue that ends the first line.

Line wrapping in the prompt

Environment

  • Oh my Posh version: 3.14.4
  • Theme: Custom
  • Operating System: MacOS
  • Shell: PowerShell Core
  • Terminal: iTerm2

Steps to Reproduce

  1. Create a theme that has a really long line that will cause wrapping and has a background color.
  2. Run oh-my-posh with the theme and note the display of the second line.
Example theme JSON with a long line
{
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "foreground": "#ff8080",
          "invert_powerline": false,
          "leading_diamond": "",
          "powerline_symbol": "",
          "properties": {
            "always_enabled": false,
            "display_exit_code": true,
            "error_color": "#e91e63",
            "postfix": "]",
            "prefix": "[⌧ EXIT"
          },
          "style": "powerline",
          "trailing_diamond": "",
          "type": "exit"
        },
        {
          "background": "#ffe9aa",
          "foreground": "#100e23",
          "invert_powerline": false,
          "leading_diamond": "",
          "powerline_symbol": "",
          "properties": {
            "root_icon": ""
          },
          "style": "powerline",
          "trailing_diamond": "",
          "type": "root"
        },
        {
          "background": "#000000",
          "foreground": "#ffffff",
          "invert_powerline": false,
          "leading_diamond": "",
          "powerline_symbol": "",
          "properties": {
            "postfix": " ",
            "user_info_separator": "@"
          },
          "style": "powerline",
          "trailing_diamond": "",
          "type": "session"
        },
        {
          "background": "#0000c0",
          "foreground": "#ffffff",
          "invert_powerline": false,
          "leading_diamond": "",
          "powerline_symbol": "",
          "properties": {
            "prefix": "",
            "style": "short"
          },
          "style": "powerline",
          "trailing_diamond": "",
          "type": "path"
        },
        {
          "background": "#00ffff",
          "foreground": "#000000",
          "invert_powerline": false,
          "leading_diamond": "",
          "powerline_symbol": "",
          "properties": {
            "command": "o=$(dotnet --version 2>/dev/null); X=$?; if [ $X -eq 0 ]; then { echo $o; exit 0; }; elif [ $X -eq 145 ]; then { echo \"[unsupported global.json]\"; exit 0; }; else exit 1; fi",
            "prefix": "",
            "shell": "bash"
          },
          "style": "powerline",
          "type": "command"
        },
        {
          "background": "#ebcc34",
          "foreground": "#000000",
          "invert_powerline": false,
          "leading_diamond": "",
          "powerline_symbol": "",
          "properties": {
            "text": "This is a really long line that should cause things to wrap and might not end nicely."
          },
          "style": "powerline",
          "type": "text"
        },
        {
          "background": "#00cc00",
          "foreground": "#000000",
          "powerline_symbol": "",
          "properties": {
            "bitbucket_icon": "",
            "branch_ahead_icon": "",
            "branch_behind_icon": "",
            "branch_icon": "",
            "branch_identical_icon": "",
            "cherry_pick_icon": "",
            "commit_icon": "",
            "display_stash_count": true,
            "display_upstream_icon": true,
            "git_icon": "",
            "github_icon": "",
            "gitlab_icon": "",
            "local_staged_icon": "",
            "local_working_icon": "",
            "merge_icon": "",
            "rebase_icon": "",
            "stash_count_icon": "",
            "tag_icon": ""
          },
          "style": "powerline",
          "type": "git"
        }
      ],
      "type": "prompt",
      "vertical_offset": 0
    }
  ],
  "console_title": false,
  "final_space": true
}

Manual Installation not working in Powershell 7

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

I installed Oh-My-Posh via powershell modules and tried out the themes with Get-PoshThemes and Set-PoshPrompt ....
Those commands are working fine.

Then I git cloned the repo, followed the Manual Installation Guide with creating C:\Tools and downloading the script there.
I copied over the Themes in the Sub-Directory C:\Tools\PoshThemes from the cloned repository.

But when I insert the code from below into $PROFILE (= Microsoft.Powershell_profile.ps1) the prompt doesn't seem to load, instead I get a regular prompt from powershell.

[ScriptBlock]$Prompt = {
  $realLASTEXITCODE = $global:LASTEXITCODE
  & "C:\Tools\oh-my-posh.exe" -config "C:\Tools\PoshThemes\powerlevel10k_classic.json" -error $realLASTEXITCODE -pwd $PWD
  $global:LASTEXITCODE = $realLASTEXITCODE
  Remove-Variable realLASTEXITCODE -Confirm:$false
}
Set-Item -Path Function:prompt -Value $Prompt -Force

The Prompt works fine if I use the following inside $PROFILE, but the loading time is around 0,5~0,7 seconds.

Set-PoshPrompt powerlevel10k_classic

Environment

  • Oh my Posh version: Latest
  • Theme: powerlevel10k_classic
  • Operating System: Windows 10
  • Shell: Powershell 7.0.3
  • Terminal: Windows Terminal 1.3.2651.0

Steps to Reproduce

  1. mkdir C:\Tools
  2. Invoke-Webrequest https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-windows-amd64.exe -OutFile C:\Tools\oh-my-posh.exe
  3. Copy themes in C:\Tools\PoshThemes
  4. Edit Powershell-Profile notepad $PROFILE and paste the sample code from above.

Expected behavior: Prompt of Oh-My-Posh when starting a new shell.
If the failure would be in the Theme, I'd at least expect the default look as mentioned in the wiki.

Actual behavior: Regular Prompt of Powershell

Regression - Navigate to PowerShell Drive causes theme to not render anymore

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Regression when using a PSDrive. Theme is not rendered anymore.

Before 3.20.4:

image

After 3.23.5:

image

Environment

  • Oh my Posh version: see above
  • Theme: custom
  • Operating System: MacOs
  • Shell: PowerShell 7.1 rc2
  • Terminal: iTerm2

Steps to Reproduce

Navigate to the PowerShell temp drive

cd temp:

Expected behavior: [What you expected to happen]

Normal behavior as before

Actual behavior: [What actually happened]

Theme doesn't render anymore

Consider multithreading for prompt segments

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

I am a user of oh-my-posh 2 with a pretty custom profile that primarily relies on shell commands (kubectl, az, and so on). I've found through experimentation that it's far more responsive to run all these commands in parallel rather than a serial foreach loop - rather than the prompt sort of "popping in" on a delay, it's almost instant.

I'm in the process of trying to update to v3 and noticed the segments get executed as a byproduct of calling enabled() which happens in a foreach-over-foreach (foreach block/foreach segment in the block).

While I've not yet finished converting or testing, I'm guessing you'd still see a pretty decent perf improvement for prompts that use a lot of commands if things were done in parallel and rendered after all the info is gathered.

Admittedly I'm more of a junior level Go programmer so I may be missing something here and could be totally wrong. And, also, since I've not yet finished converting my theme I can't actually cite stats. It just seems logical that if the shell is executing the oh-my-posh executable, then that executable is starting a separate process in serial for additional shell commands that some multithreading could speed that up.

Environment

  • Oh my Posh version: 2.0.472 upgrading to 3.14.2
  • Theme: Custom
  • Operating System: MacOS
  • Shell: PowerShell Core
  • Terminal: Mac Terminal

[Bash] incorrect/early text wrapping

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

When using the terminal, the text seems to wrap weirdly,
Seems to wrap around early, and doesn't continue on a newline, overwriting the PS1 text

Environment

  • Oh my Posh version: 3.14.2
  • Theme: Default / JanDeDobbeleer
  • Operating System: Ubuntu20.04
  • Shell: Bash v5.0.17
  • Terminal: Tilix / Gnome Terminal

Steps to Reproduce

  1. Open Terminal
  2. Start typing

Expected behavior: Text wraps around at the end of the window

Actual behavior: Text wraps around early / overwrites PS1 text

image

No longer possible to use shell functions to calculate a segment's value?

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

If I'm understanding the new structure, it seems like the only way(s) of creating a new type of segment are to either run a subprocess or write a new module for Oh-My-Posh. Is that correct? The reason I ask is that I have a Powershell function that returns the execution time of the last command, and that uses shell features (get-history) to get the data. So it can't be run in either of the two ways that seem to now be available.

I understand that the resulting configuration would not be portable across shells, but that isn't an issue for me.

Is this an intended limitation of the new version, or is it likely to be possible to do this at some point?

Environment

  • Oh my Posh version: 3
  • Theme: N/A
  • Operating System: Windows 10
  • Shell: Powershell
  • Terminal: Windows Terminal

$Home printed as well as ~

I think it should be replacing the text but is being printed before it. Seems to happen in all themes which print the whole path.
image

Too much latency compared to oh-my-posh2

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

There is too much latency compared to oh-my-posh2, especially when
typing the clear command.

Environment

  • Oh my Posh version: 3.11.0
  • Operating System: Windows 10 20H2
  • Shell: PowerShell Core 7.0.3
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Type clear command in the terminal.
  2. You will see some latency until the shell bar pops up.

Expected behavior:
Little to no latency.

Actual behavior:
Some latency.

Segment Path does not work with Windows Registry

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

When navigating to the registry, the path segment does not show the registry path.
Oh-my-posh3:
image
Default behavior:
image

Environment

  • Oh my Posh version: 3.8.0
  • Operating System: Windows 10 2004
  • Shell: Powershell 7
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Open Powershell
  2. Go to the registry, by typing cd HKLM:

Expected behavior: Expected path segment to show: HKLM:\

Actual behavior: Previous path is displayed

Time of command execution

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Hi,

is it possible to display the time the last command took?
In v2 i wrote a function in the .psm1.
image

Cheers,
Maurice

Issue in rendering path having space

Prerequisites

  • [ x ] I have read and understand the CONTRIBUTING guide
  • [ x ] I looked for duplicate issues before submitting this one

Description

[Description of the bug or feature]

Environment

  • Oh my Posh version: 3
  • Theme: zash
  • Operating System: windows 10 2003
  • Shell: powershell
  • Terminal: windows terminal

Steps to Reproduce

installed oh-my-posh according to the steps mentioned in the readme

Expected behavior: The pathname on the terminal should be C:\Users\Jibin Thomas\dev

Actual behavior: The path is being truncated till the space C:\Users\Jibin

Attaching a screenshot of the problem
Capture

OMP3 doesn't updates terminal title like OMP2 did

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Terminal title is not set to current directory. Perhaps it could be made into optional setting where different values can be added into it?
image

Environment

  • Oh my Posh version: 3.13.0
  • Theme: powerlevel10k_classic
  • Operating System: Windows 10 / Debian 9
  • Shell: PowerShell 7
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Import-Module oh-my-posh
  2. change current working directory

Expected behavior: Title has current path

Actual behavior: Current shell name is present

Regression - Git segment doesn't render anymore

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

The git segment doesn't work anymore. Last version it worked for me was 3.23.5. In the screenshot you can see I checked 2 newer versions (2.24.3 and 2.26.1)

image

I checked both with a PSDrive path (my normal operation, GIT:/bgelens.github.io) and normal filesystem path (/Users/bengelens/git/bgelens.github.io).

Environment

  • Oh my Posh version: see above
  • Theme: custom
  • Operating System: MacOs
  • Shell: PowerShell 7.1 rc2
  • Terminal: iTerm2

Steps to Reproduce

Load explicit version via profile:

Working version:

#requires -Module @{ModuleName = 'oh-my-posh'; RequiredVersion = '3.23.5'}

Non working version:

#requires -Module @{ModuleName = 'oh-my-posh'; RequiredVersion = '3.26.1'}

Navigate to a git repository on disk

Expected behavior: [What you expected to happen]

Should render

Actual behavior: [What actually happened]

Does not render

In the prompt displays an error "-error 0"

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

[Description of the bug or feature]

Environment

  • Oh my Posh version: 3.23.5
  • Theme: powerlevel10k_lean, avit, etc
  • Operating System: Windows 10
  • Shell: PowerShell 7.0.3
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Open terminal window
  2. Go to disk root cd \
  3. See error

prompt_error

Expected behavior: In the prompt displays an error "-error 0"

Actual behavior: there are no errors in the prompt

BATT Err using jandedobbeleer theme

Hey,

its me again..

i'm playing around with different themes and their configuration and come along with the following behaviour..

when my notebook is plugged in and fully charged, i get the "BATT ERR", when its loading it shows the percentage in green and when its not plugged in the information is displayed in red.

is it only on my machine with the batt err ?

grafik

_

_

feature request: theme function call custom render

Is there planned, or could there be, the following feature:

Some way to implement in a function block? I see other block types such as spotify, git, battery, shell, exit and others.

A "function" block that is digested and renders would be extremely versatile.

Support for CMD

Since this is a (almost) platform-agnostic shell themer, is there a way to support Command Prompt in Windows?

For inspiration, you can check out how Cmder does it.
For the most part, it just requires changing the prompt environment variable. Like this, for example:

SETX /M PROMPT "$E[1;32;40m→ $E[1;36;40m$p$E[1;35;40m› $E[1;37;40m" 

Icons don't render in prompt function, but do directly from oh-my-posh.exe

Description

Character encoding is broken in prompt function, but not when I call oh-my-posh directly.

Environment

  • Oh my Posh version: 3.17
  • Theme: Custom (same behavior with default theme)
  • Operating System: Win 10 2004
  • Shell: PowerShell 7.0.3
  • Terminal: Windows Terminal 1.3.2651.0

Steps to Reproduce

Prompt doesn't render icons, but if you run oh-my-posh directly with the same config it renders as expected.
image

Prompt function script:

    [ScriptBlock]$Prompt = {

        $realLASTEXITCODE = $global:LASTEXITCODE
        if ([string]::IsNullOrEmpty($realLASTEXITCODE) ) { $realLASTEXITCODE = 0 }
        & oh-my-posh -config C:\Users\chunt\.ohmyposh.json -error $realLASTEXITCODE -pwd $PWD.Path
        $global:LASTEXITCODE = $realLASTEXITCODE
        Remove-Variable realLASTEXITCODE -Confirm:$false
      }
      Set-Item -Path Function:\prompt -Value $Prompt -Force
}

Hide battery segment when no information.

First of all, ❤️ this module! Finally switched over from oh-my-posh 🙂

I like your default theme (jandedobbeleer) but it shows "BATT ERR" on my desktop because no battery info, of course. IMHO it's better to not display the segment if no info but others may disagree.

To cater for both cases, it would be great if you could optionally specify a condition (scriptblock that returns boolean for example) for each segment in the JSON config that determines if the segment gets displayed or not.

Run shell commands for command segment directly in shell

In comments for #26, I mentioned wanting to create a segment that displays an icon only if (Get-PSReadLineOption).HistorySaveStyle -ne 'SaveNothing'. This does not work correctly because each time, the command gets run in a new instance of pwsh.

Theme used to test this: https://gist.github.com/AjayKMehta/1b5324a485a9db6e7d326276ab5786cf

@JanDeDobbeleer said he would look into seeing if he can modify the code so that a command can be run directly in your shell fixing this problem.

In git segment, option to remove detailed added/modified/etc counts but keep status icon.

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

I'd like the git segment to include some icon to indicate there are local changes in working or staged, but without the detailed status string like ~1 or ?1

Environment

  • Oh my Posh version: 3.22.1
  • Theme: custom, here's the relevant segment:
                {
                    "type": "git",
                    "style": "plain",
                    "foreground": "#D0666F",
                    "properties": {
                        "branch_icon": "",
                        "branch_identical_icon": "",
                        "branch_ahead_icon": "",
                        "branch_behind_icon": "",
                        "branch_gone_icon": "",
                        "display_status": true,
                        "status_separator_icon": "",
                        "local_working_icon": "\u2717",
                        "local_staged_icon": "\u2717",
                        "commit_icon": "",
                        "rebase_icon": "",
                        "tag_icon": "",
                        "cherry_pick_icon": "",
                        "merge_icon": "",
                        "working_color": "#FFFF00",
                        "staging_color": "#00FF00",
                        "status_colors_enabled": true,
                        "color_background": false,
                        "prefix": " ",
                        "postfix": ""
                    }
                }
  • Operating System: macOS
  • Shell: pwsh
  • Terminal: vs code integrated

Steps to Reproduce

For these example shell commands that create blah, git add it, then create blah2:

~/repo develop  $ touch blah
➜ ~/repo develop  ✗ ?1 $ git add blah
➜ ~/repo develop  ✗ +1 $ touch blah2
➜ ~/repo develop  ✗ +1 ✗ ?1 $ git status
On branch develop
Your branch is up to date with 'origin/develop'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   blah

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        blah2

Expected behavior: Prompt is ➜ ~/repo develop ✗ $ (colored appropriately based on working_color and staging_color) If both working and staged changes, then two with one of each color .

Actual behavior: Prompt is ➜ ~/repo develop ✗ ?1 $ or ➜ ~/repo develop +1 $


I could imagine a settings like status_display_details that controls whether https://github.com/JanDeDobbeleer/oh-my-posh3/blob/23233bc383b1eebe61b6493fd78140da3f2fdb83/segment_git.go#L133 includes the whole gitStatus string, or just the prefix.

Dynamic background colors

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

using v2 of oh-my-posh i used different backgroundcolors to indicate the status of the local git repo
image

Is this still possible via envvar or is it static only?

Issue with the fonts

Hi,
I am still facing icons issue on Powershell with the theme "jandedobbeleer.json".
Meslo LGM NF fonts are installed.

image

Here the theme file coming directly from the module:
image

I suppose the encoding is broken.

I am using:

  • Windows 10 Pro (build 2004)
  • Powershell 7.0.3
  • Powershell module : oh-my-posh 3.5.1 (scope: CurrentUser)

Thanks

Plain text ANSI - SetConsoleMode fails on older versions of Windows 10

Prerequisites

  • [*] I have read and understand the CONTRIBUTING guide

  • [*] I looked for duplicate issues before submitting this one

Description

I followed the docs and upgraded oh my posh 2 to V3 on my Win10 machine using Powershell in admin mode. When I run the terminal I get the following exception:

PC=0x50c79a0000

syscall.loadsystemlibrary(0xc000010e00, 0xc000012800, 0xc000012800, 0x20)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/runtime/syscall_windows.go:136 +0xe7
syscall.LoadDLL(0xfe1e92, 0xb, 0xc000024000, 0xc00001a000, 0xc0000758d8)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:81 +0x16a
syscall.(*LazyDLL).Load(0xc0000041e0, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:245 +0xc8
syscall.(*LazyProc).Find(0xc000043bf0, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:300 +0xbf
syscall.(*LazyProc).mustFind(...)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:318
syscall.(*LazyProc).Addr(...)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:327
syscall.GetUserProfileDirectory(0x1f4, 0xc0001241a0, 0xc0000759b8, 0xc0001241a0, 0x509fe3f4a0
)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/zsyscall_windows.go:1910 +0x3e
syscall.Token.GetUserProfileDirectory(0x1f4, 0xc00000ef90, 0x2c, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/security_windows.go:368 +0x8f
os/user.current(0x0, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/os/user/lookup_windows.go:217 +0x1c7
os/user.Current.func1()
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x10f7de0, 0xfef020)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/sync/once.go:66 +0xf7
sync.(*Once).Do(...)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/sync/once.go:57
os/user.Current(0xc0001029c0, 0xc000102990, 0xc000005a60)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/os/user/lookup.go:15 +0x105
main.(*environment).getCurrentUser(0xc000006050, 0xc000005a00, 0xc0000059e0, 0xc0000059c0)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/environment.go
:99 +0x29
main.(*session).getUserName(0xc0000059a0, 0x0, 0x0)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_sessio
n.go:64 +0x68
main.(*session).getFormattedText(0xc0000059a0, 0x0, 0x0)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_sessio
n.go:40 +0x47
main.(*session).string(0xc0000059a0, 0x1017801, 0xc000006050)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_sessio
n.go:31 +0x32
main.(*Segment).string(...)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment.go:72
main.(*engine).renderBlockSegments(0xc000075f40, 0xc0000401e0, 0x0, 0x0)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/engine.go:97 +
0x1c3
main.(*engine).render(0xc000075f40)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/engine.go:126
+0xe5
main.main()
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/main.go:64 +0x
3f5
rax     0x7ffe253672d4
rbx     0xffffffffffbadd11
rcx     0x41
rdi     0x509fd91700
rsi     0x7ffe253672d4
rbp     0x0
rsp     0x509fcbef00
r8      0x0
r9      0x8ac
r10     0x0
r11     0x509fe3f430
r12     0x7ffe29330000
r13     0x7ffe253610e8
r14     0xc000007a
r15     0x7ffe25365c70
rip     0x50c79a0000
rflags  0x10206
cs      0x33
fs      0x53
gs      0x2b```

My PS profile:

$PSDefaultParameterValues["Out-File:Encoding"] = "utf8"
$MaximumHistoryCount = 1000;

Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme agnoster
Set-Location C:\repos

Environment

  • Oh my Posh version: v3.13.0
  • Theme: agnoster
  • Operating System: Windows 10 build 10240
  • Shell: Powershell
  • Terminal: Allacritty (the same thing happens in standard PS 7 terminal)
  • Go version: go version go1.15.2 windows/amd64 (not sure if this matters)

Steps to Reproduce

  1. Install posh git and oh my posh.
  2. Update config file.
  3. Start terminal.

Expected behavior: [What you expected to happen]
Terminal starts without issues

Actual behavior: [What actually happened]
Oh my pish throws an exception

Posh-Git should be in RequiredModules

Since the module will not load without Posh-Git, it should be in the required modules of the manifest so that install-module (and install-psresource) automatically install the dependency.

Alternatively, remove posh-git from the main psm1 dependency and only do a check if git related segments are used (preferred)

Allow the 16 basic ANSI colors in addition to HEX colors

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

First of all I totally love this project and it makes using the CLI much more enjoyable for me.

Ok now to the actual idea:

I use oh-my-posh for the powershell which I mainly run inside the windows terminal.
Basically there are a couple of nice themes for the terminal, which map the 16 basic ANSI colors to nicer-looking ones.

So I thought about how I could re-use the color scheme from the windows terminal theme in my oh-my-posh theme without copying all the colors over and fine-tuning them there.

The old oh-my-posh used the 16 basic colors which were adapted by the windows terminal theme quite nicely.

In the end i would like to be able to specify the basic 16 ANSI colors in a theme .json like in this example segment:

        {
          "type": "git",
          "style": "powerline",
          "powerline_symbol": "\uE0B0",
          "foreground": "black",
          "background": "lightYellow"
        },

Maybe also using a prefix for color names such as "$black" and "$lightYellow" to make the names more recognizable and easier distinguish between hex and name.

Environment

  • Theme: agnoster / basically any theme
  • Operating System: windows
  • Shell: powershell
  • Terminal: windows terminal

Other

I would like to contribute the code myself.

Posh-Git autocomplete broken when importing oh-my-posh3 in $profile

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

With empty profile:
empty-profile

With imports in profile:
with-profile

posh-git's contextual autocomplete is not working if I have these three lines in my $profile:

Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt powerlevel10k_lean

Interestingly, if I remove those and import them at the commandline in that same order, everything works just fine.

Environment

  • Oh my Posh version: 3.28.0
  • Theme: powerlevel10k_lean (also tried agnoster, same problem)
  • Operating System: Windows 10
  • Shell: Powershell 7.0.3
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Add these lines to your $profile
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt powerlevel10k_lean
  1. navigate to directory containing git repo cd C:\path\to\git\repo
  2. make a change to a file (or create a new one) to create an unstaged change scenario. for this, calling this file "dir/to/filetoadd.txt"
  3. type git add (include a space after "add") and hit {TAB}

Expected behavior: Terminal autocompletes to: git add dir/to/filetoadd.txt

Actual behavior: Terminal autocompletes to something else, like git add .\.git\

SSH Segment or SSH handling in Session

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

I'd like to add some special handling if detected running in an ssh session.

Would an ssh specific segment be best for this? Or would some properties on the hostname in the session segment be more appropriate. I'm thinking like ssh-foreground, ssh-background, ssh-icon.

Environment

  • Oh my Posh version: 3.11.2
  • Theme: all
  • Operating System: all
  • Shell: all
  • Terminal: all

Feature request

  1. Ability to change the color for git based on branch is clean or not
    2.Remove extra spacing in git block information. And between type Block.

Theme not working correctly after installing v3.23

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

After installing v.3.23, the custom theme that I created that uses an envvar segment for the prompt does not display correctly after the module is imported. Subsequently, the prompt is written correctly.

I am guessing this is because the prompt is written before the initial call to Set-PoshContext now?

See screenshot below:

Screenshot 2020-10-26 200625

Environment

Steps to Reproduce

Set-PSReadLineOption -HistorySaveStyle SaveIncrementally

Import-Module 'posh-git', 'oh-my-posh' -Force

function Set-EnvVar {
    $env:POSH=$(if ((Get-PSReadLineOption).HistorySaveStyle -ne 'SaveNothing'){[char]::ConvertFromUtf32(0x1f4be)} else {''})
}

if (Get-Alias 'Set-PoshContext' -ErrorAction Ignore) {
    Remove-Alias 'Set-PoshContext'
}

New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global
	
Set-PoshPrompt -Theme "$PSScriptRoot\Themes\cool.json"

Expected behavior:

I expected to see a segment at the end with 💾 in the prompt after running the code (copied from my profile.ps1).

Actual behavior:
There is no segment at the end with 💾 in it. Subsequently, the prompt is written correctly, i.e. a segment at the end with 💾 .

Theme not loaded when installation path contains spaces

Prerequisites

  • [ x ] I have read and understand the CONTRIBUTING guide
  • [ x ] I looked for duplicate issues before submitting this one

Description

Selected theme is not loaded by name or path (that contains spaces), but get-themes is working.

Environment

  • Oh my Posh version: 3.23.1
  • Theme: any
  • Operating System: Windows 10 Pro 2004
  • Shell: Powershell 7
  • Terminal: Microsoft Terminal

Steps to Reproduce

  1. Install Oh My Posh for local user, in Documents, that is synched on a Sharepoint Onedrive, so the path contains spaces
  2. Ask to use any theme by name: none are working
  3. Use a theme by path: not working either
  4. Go to the themes installation directory, use a theme by path: ok when inside this directory, ko when somewhere
  5. Make a junction of the themes directory to somewhere without spaces and use theme by path: ok

Oh My Posh is installed in ~\OneDrive - XXX\Documents\PowerShell\Modules\oh-my-posh\
When using theme from there (either by referencing it by name or by full path), it's not working.
When using theme from a path without spaces it works.

image

Expected behavior:
Selected theme to be used

Actual behavior:
Default theme used

Prompt position calculation after newline

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

After adding a newline the prompt position doesn't seem to be calculated correct. Notice the vertical bar on the right side of the screenshot.
image

Environment

  • Oh my Posh version:3.16.0
  • Theme: custom
  • Operating System: Microsoft Windows [Version 10.0.19041.572]
  • Shell: NuShell
  • Terminal: Windows Terminal Preview v1.4.2652

Steps to Reproduce

  1. Install Nushell
  2. Use the custom json below.
  3. in nushell's config.toml change set prompt = "= `{{$(c:\\path\\to\\posh-windows-amd64.exe -config C:\\path\\to\\copy.json | str collect)}}`"

Expected behavior: [What you expected to happen]
I excpect the prompt location to be next to the >
Actual behavior: [What actually happened]
the prompt location is moved over to the right about the same spot as if there wasn't a newline in my copy.json.

copy.json

{
  "blocks": [
    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        {
          "type": "time",
          "style": "plain",
          "foreground": "#E5C07B",
          "properties": {
            "time_format": "2006-01-02 3:04:05.000 AM",
            "prefix": "",
            "postfix": ""
          }
        },
        {
          "type": "root",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#100e23",
          "background": "#ffe9aa",
          "properties": {
            "root_icon": ""
          }
        }
      ]
    },
    {
      "type": "newline"
    },
    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        {
          "type": "path",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#ffffff",
          "background": "#3364a1",
          "properties": {
            "home_icon": "~",
            "folder_icon": "",
            "windows_registry_icon": "",
            "folder_separator_icon": "",
            "style": "short"
          }
        },
        {
          "type": "git",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#000000",
          "background": "#95ffa4",
          "properties": {
            "branch_icon": "",
            "branch_identical_icon": "",
            "branch_ahead_icon": "",
            "branch_behind_icon": "",
            "branch_gone_icon": "",
            "branch_untracked_icon": "\u2262",
            "local_working_icon": "",
            "local_staged_icon": "",
            "rebase_icon": "",
            "cherry_pick_icon": "",
            "detached_icon": "",
            "tag_icon": "",
            "display_stash_count": true,
            "stash_count_icon": "\uF692 ",
            "merge_icon": "\uE726 ",
            "display_upstream_icon": true,
            "github_icon": "\uE709",
            "bitbucket_icon": "\uE703",
            "gitlab_icon": "\uE296",
            "git_icon": "\uE702"
          }
        },
        {
          "type": "python",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#100e23",
          "background": "#906cff",
          "properties": {
            "prefix": ""
          }
        },
        {
          "type": "exit",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#ffffff",
          "background": "#ff8080",
          "properties": {
            "prefix": ""
          }
        }
      ]
    }
  ],
  "final_space": true
}

Add WSL indication segment

Goal: a segmnet that shows you're inside the WSL. There should be an evironment variable we can use: WSL_DISTRO_NAME. If that one's set, you know you're inside of the WSL.

Difficulties with icons in prompt

Hi, I might be missing something fundimental, but it appears that the characters representing items on the prompt are incorrect-ish?

Here's an example:
image

If I edit the theme in vscode, only certain glyphs render correctly:

image

I'm wondering if there's a character encoding thing going on with the file maybe?

image

Upgrade not working on Windows PowerShell

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Oh-My-Posh-3 commands are not working when I upgrade the module.

Environment

  • Oh my Posh version: 3.23.0-beta
  • Theme: Any theme
  • Operating System: Windows 10.0.19042
  • Shell: PowerShell 5.1.19041.546
  • Terminal: Windows Terminal

Steps to Reproduce

Just followed the instructions given here - https://ohmyposh.dev/docs/upgrading

Expected behavior: The commands should work since no specific minimum version of PowerShell is specified anywhere in the docs.

Actual behavior: image

wrapping strange with nushell

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

[Description of the bug or feature]
Text truncates and wraps in an odd way with nushell. I'm not sure what's going on.
image

The strange thing here is the cursor is as far right as possible and that point is between the o and r in the word selector.
If I hit enter with the cursor there it executes the entire line just fine.
If I hit backspace it starts deleting characters from the end of the line where it says first 5 but the cursor moves from where it's at between the o and r by one space left.

Environment

Windows

  • Oh my Posh version: 3.26.4 i think but i'm not sure how to tell
  • Theme: Custom
  • Operating System: Windows
  • Shell: Nushell
  • Terminal: Windows Terminal Preview

Steps to Reproduce

  1. using it regularly. sometimes i maximize the window. sometimes I restore the window but it happens whenver there is line wrapping

refactor: disambiguate property constants across segments

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

When creating a new segment configuration options are specified as constants, like this for the "Exit" segment:

const (
	//DisplayExitCode shows or hides the error code
	DisplayExitCode Property = "display_exit_code"
	//AlwaysEnabled decides whether or not to always display the exitcode info
	AlwaysEnabled Property = "always_enabled"
	//ErrorColor specify a different foreground color for the error text when using always_show = true
	ErrorColor Property = "error_color"
)

The challenge is that since all the segments are in the same package, the constants defined here (AlwaysEnabled) which appear to be per-segment actually aren't. If I wanted a property for a different segment to have an always_enabled configuration option I'd have to either:

  • Name it something different, like MySegmentAlwaysEnabled; or
  • Use the constant defined by a different segment, which feels sort of odd.

Maybe that first option is fine, but it seems weird that some of the segments would need a prefix for their constants but there wouldn't be a convention across all the segments.

I'm not sure what the best solution to this is. Since Go doesn't have a notion of file-scoped variables or constant structs, I'd guess the options are:

  • Don't do anything, just fix it with name prefixes going forward.
  • Refactor all the segments to prefix their associated constants with the segment name (or some similar convention).
  • Put all the configuration constants in a single file. This would make it harder to see what each segment uses, but it'd also enable easier standardization of configuration properties across segments. You wouldn't get always_enabled vs enable_always or something because everyone would be using the same constant for the same intent.
  • Put each segment in a different Go package. This seems like it'd be more work but it might be nice to isolate the code and tests for an individual segment.

I didn't know what the preference here was so I figured I'd open an issue and ask. I'd be happy to PR an update if it sounds like some refactoring needs to be done. And if not, I'm glad I asked. 😄

Aside: Thanks for your patience and help with the issues and PRs I'm throwing your way. I'm pretty excited about this new OMP version and it's helping me bring up my Go skills.

feat: different color to distinguish git staging (index) and working directory status

Vanilla posh-git shows staging (index) and working directory information in different color which is same as color scheme used by git status command.

image

When using Paradox theme, it shows everything using single color:

image

I am guessing there is a way to override all prompt colors but if this is part of theme, that would be great.

If someone knows how to change color of these info, please let me know.

Thanks.

Copied from here

Shell arg doesn't override Shell string

I'm messing around with oh-my-posh in nushell and the shell segment is coming up as cmd since it appears to run under cmd.exe. Providing the -shell arg doesn't change the string in the shell segment.

I also tried to use the -shell arg from PowerShell and Bash and it always returns the string in the environment variable.

On quick inspection, I don't see why the code isn't working.

https://github.com/JanDeDobbeleer/oh-my-posh3/blob/1c6944b1dbdca5a4474ba75733adace8f00b480d/main.go#L54-L57

Box symbols in prompt

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Tried running in Windows Terminal and in Powershell directly, the symbols in many themes are not appearing correctly.

Environment

  • Oh my Posh version: 3.21.0
  • Theme: powerline
  • Operating System: Windows 10 2004
  • Shell: Powershell 7.0.3
  • Terminal: Windows Terminal
  • Font: Cascadia Code PL 2009.022

Steps to Reproduce

  1. Run Get-PoshThemes

Expected behavior: No box symbols

Actual behavior:
image

Set-PoshPrompt doesn't resolve path using home ~

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Set-PoshPrompt doesn't resolve path using home ~

Environment

  • Oh my Posh version: 3.23.4
  • Theme: ~/OneDrive/Documents/PowerShell/.go-my-posh.json
  • Operating System: macOS 10.15.7
  • Shell: pwsh
  • Terminal: iTerm2

Steps to Reproduce

From a good prompt, I'll run

Set-PoshPrompt ~/OneDrive/Documents/PowerShell/.go-my-posh.json
Set-PoshPrompt ( Resolve-Path ~/OneDrive/Documents/PowerShell/.go-my-posh.json )

Expected behavior: prompt should always be ➜ ~/OneDrive/Documents/PowerShell

Actual behavior:

➜ ~/OneDrive/Documents/PowerShell Set-PoshPrompt ~/OneDrive/Documents/PowerShell/.go-my-posh.json
 [email protected]   PowerShell  96  ﲵ pwsh    Set-PoshPrompt ( Resolve-Path ~/OneDrive/Documents/PowerShell/.go-my-posh.json )
➜ ~/OneDrive/Documents/PowerShell

You can see that Set-PoshPrompt ~/OneDrive/Documents/PowerShell/.go-my-posh.json causes the prompt to become the default powerline:  carl@MACPC   PowerShell  96  ﲵ pwsh   


Workaround is to call Resolve-Path first like:

Set-PoshPrompt ( Resolve-Path ~/OneDrive/Documents/PowerShell/.go-my-posh.json )

Question: How to find codes for symbols

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Hi Jan,

just a simple (and maybe stupid) question. 😊
Where do you find all the codes for the symbols like the GitHub Icon \uF408 ?

Many thanks in advance!

Cheers,
Maurice

Background colors on segments not rendering in MacOS during manual execution

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Using the example theme from the documentation and running oh-my-posh manually, I don't see background colors rendered.

I'm not sure if this is an artifact of trying to execute it manually or if this means there's something else I need to set. I was trying to do some testing to verify #177 and try converting my custom v2 theme to v3, but I'm not willing to mess up my existing prompt environment if I can't tell if this is going to work the same.

Environment

  • Oh my Posh version: 3.14.2
  • Theme: Example from docs.
  • Operating System: MacOS
  • Shell: PowerShell Core
  • Terminal: Mac Terminal

Steps to Reproduce

First, create example.json with the theme from the docs. Note it has a foreground and background color.

Theme:

{
  "final_space": true,
  "blocks": [
    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        {
          "type": "path",
          "style": "powerline",
          "powerline_symbol": "",
          "foreground": "#ffffff",
          "background": "#61AFEF",
          "properties": {
            "prefix": "",
            "style": "folder"
          }
        }
      ]
    }
  ]
}

Next, run the oh-my-posh executable and pass it the example.json as the configuration, like:

posh-darwin-amd64 -config ./example.json

Expected behavior: I expected to see the current folder shown with a white foreground and a light blue background.

Actual behavior:

Manual run of oh-my-posh 3

Note there's no light blue background and the foreground color is not white.

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.