The most customisable and low-latency cross platform/shell prompt renderer
Find a file
Jan De Dobbeleer afaaace35b refactor: final_space is better name
I\'m coming for you Avocato
2020-10-05 17:19:05 +02:00
.github fix: create release for chores 2020-09-21 11:51:03 +02:00
.vscode feat(pkg): add PowerShell package 2020-09-16 10:46:50 +02:00
packages/powershell/go-my-posh refactor: rename Themes folder for consistency 2020-10-05 17:19:05 +02:00
Themes refactor: final_space is better name 2020-10-05 17:19:05 +02:00
commitlint.config.js feat: initial commit 2020-09-12 08:57:18 +02:00
.gitignore feat: initial commit 2020-09-12 08:57:18 +02:00
appveyor.yml feat: initial commit 2020-09-12 08:57:18 +02:00
COPYING feat: initial commit 2020-09-12 08:57:18 +02:00
engine.go refactor: final_space is better name 2020-10-05 17:19:05 +02:00
environment.go refactor: format shell name better 2020-09-24 19:34:19 +02:00
environment_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
environment_unix.go feat: initial commit 2020-09-12 08:57:18 +02:00
environment_windows.go feat: initial commit 2020-09-12 08:57:18 +02:00
Gopkg.lock chore: update dependencies 2020-09-21 09:27:20 +02:00
Gopkg.toml chore: remove unused dependency 2020-09-21 20:29:50 +02:00
main.go refactor: change powerline config to segment 2020-10-05 17:19:05 +02:00
properties.go feat: initial commit 2020-09-12 08:57:18 +02:00
properties_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
README.md fix: use correct theme name 2020-10-05 17:19:05 +02:00
renderer.go refactor: escape color sequences on zsh 2020-09-24 19:34:19 +02:00
renderer_test.go refactor: escape color sequences on zsh 2020-09-24 19:34:19 +02:00
segment.go refactor: change powerline config to segment 2020-10-05 17:19:05 +02:00
segment_battery.go fix: remove incorrect percentage indicator 2020-09-16 10:46:50 +02:00
segment_battery_test.go fix: remove incorrect percentage indicator 2020-09-16 10:46:50 +02:00
segment_command.go refactor: escape color sequences on zsh 2020-09-24 19:34:19 +02:00
segment_command_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_exit.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_exit_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_git.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_git_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_nvm.go feat: add node version segment 2020-09-17 17:47:32 +02:00
segment_nvm_test.go feat: add node version segment 2020-09-17 17:47:32 +02:00
segment_path.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_path_test.go refactor: format shell name better 2020-09-24 19:34:19 +02:00
segment_root.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_session.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_session_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_shell.go refactor: format shell name better 2020-09-24 19:34:19 +02:00
segment_shell_test.go refactor: format shell name better 2020-09-24 19:34:19 +02:00
segment_spotify.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_spotify_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_test.go fix: ignore segments without writer 2020-09-17 17:47:32 +02:00
segment_text.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_time.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_virtualenv.go feat: initial commit 2020-09-12 08:57:18 +02:00
segment_virtualenv_test.go feat: initial commit 2020-09-12 08:57:18 +02:00
settings.go refactor: final_space is better name 2020-10-05 17:19:05 +02:00

A prompt theme engine for any shell

example workflow name Go Report Card

What started as the offspring of oh-my-posh 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 ❤

Patreon Liberapay Ko-Fi

Features

  • Git status indications
  • Failed command indication
  • Admin indication
  • Current session indications
  • Configurable

Table of Contents**

Installation

go-my-posh uses ANSI color codes under the hood, these should work everywhere, but you may have to set your $TERM to xterm-256color for it to work.

For maximum enjoyment, make sure to install a powerline enabled font. The fonts I use are patched by [Nerd Fonts][nerdfonts], which offers a maximum of icons you can use to configure your prompt.

Powershell

A PowerShell module is available for your enjoyment. Install and use it with the following commands.

Install-Module -Name go-my-posh -Repository PSGallery
Import-Module go-my-posh
Set-PoshPrompt paradox

The Set-PoshPrompt function has autocompletion to assist in correctly typing the correct theme. It accepts either one of the pre-configured themes, or a path to a theme of your own.

To see available themes, make use of the Get-PoshThemes function. This prints out all themes based on your current location/environment.

Precompiled Binaries

You can find precompiled binaries for all major OS's underneath the releases tab. Installation instruction for the different shells below assumes <go-my-posh> points to the go-my-posh binary and you've downloaded the jandedobbeleer theme to your $HOME directory.

On UNIX systems, make sure the binary is executable before using it.

chmod +x gmp_executable

Bash

Add the following to your .bashrc (or .profile on Mac):

function _update_ps1() {
    PS1="$(<go-my-posh> -config ~/jandedobbeleer.json -error $?)"
}

if [ "$TERM" != "linux" ] && [ -f <go-my-posh> ]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi

ZSH

Add the following to your .zshrc:

function powerline_precmd() {
    PS1="$(<go-my-posh> -config ~/jandedobbeleer.json --error $?)"
}

function install_powerline_precmd() {
  for s in "${precmd_functions[@]}"; do
    if [ "$s" = "powerline_precmd" ]; then
      return
    fi
  done
  precmd_functions+=(powerline_precmd)
}

if [ "$TERM" != "linux" ]; then
    install_powerline_precmd
fi

Fish

Redefine fish_prompt in ~/.config/fish/config.fish:

function fish_prompt
    eval <go-my-posh> -config ~/jandedobbeleer.json -error $status
end

Nix

When using nix-shell --pure, go-my-posh will not be accessible, and your prompt will not appear.

As a workaround you can add this snippet to your .bashrc, which should re-enable the prompt in most cases:

# Workaround for nix-shell --pure
if [ "$IN_NIX_SHELL" == "pure" ]; then
    if [ -x <go-my-posh> ]; then
        alias powerline-go="<go-my-posh> -config ~/jandedobbeleer.json"
    fi
fi

Configuration

As the documentation for all the different segments is still lacking, have a look at the available themes for reference.

Every segment has its own properties you can set/override. Have a look at the code for any you would want to tweak, available options are listed as the Property constant with their respective JSON notation for use in a segment's properties section. Additionally, a few general properties are available cross segments which can be found in properties.go.

Roadmap

  • CI
  • Github Releases
  • Create documentation for manual installation
  • Create documentation on the different segments
  • Create easy installation packages
    • Powershell
    • Brew
    • Chocolatey

Thanks

  • Chris Benti for providing the first influence to start oh-my-posh
  • Keith Dahlby for creating posh-git and making life more enjoyable
  • Robby Russel for creating oh-my-zsh, without him this would probably not be here
  • Janne Mareike Koschinski for providing information on how to get certain information using Go (and the amazing README)