afaaace35b
I\'m coming for you Avocato |
||
---|---|---|
.github | ||
.vscode | ||
packages/powershell/go-my-posh | ||
Themes | ||
commitlint.config.js | ||
.gitignore | ||
appveyor.yml | ||
COPYING | ||
engine.go | ||
environment.go | ||
environment_test.go | ||
environment_unix.go | ||
environment_windows.go | ||
Gopkg.lock | ||
Gopkg.toml | ||
main.go | ||
properties.go | ||
properties_test.go | ||
README.md | ||
renderer.go | ||
renderer_test.go | ||
segment.go | ||
segment_battery.go | ||
segment_battery_test.go | ||
segment_command.go | ||
segment_command_test.go | ||
segment_exit.go | ||
segment_exit_test.go | ||
segment_git.go | ||
segment_git_test.go | ||
segment_nvm.go | ||
segment_nvm_test.go | ||
segment_path.go | ||
segment_path_test.go | ||
segment_root.go | ||
segment_session.go | ||
segment_session_test.go | ||
segment_shell.go | ||
segment_shell_test.go | ||
segment_spotify.go | ||
segment_spotify_test.go | ||
segment_test.go | ||
segment_text.go | ||
segment_time.go | ||
segment_virtualenv.go | ||
segment_virtualenv_test.go | ||
settings.go |
A prompt theme engine for any shell
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 ❤
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)