6fd9f0bdd9
Powershell has an issue rendering multiline prompts when it comes to PSReadline on MacOS. To mitigate that, we make it a multiline prompt by moving the cursor all the way to the end. That way, PSReadline believes this is still a one line prompt and everything works as expected. https://github.com/PowerShell/PowerShell/issues/3687 |
||
---|---|---|
.github | ||
.vscode | ||
packages/powershell/go-my-posh | ||
Themes | ||
commitlint.config.js | ||
.gitignore | ||
appveyor.yml | ||
color_writer.go | ||
color_writer_test.go | ||
COPYING | ||
engine.go | ||
engine_test.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 | ||
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_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.
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> -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
Powershell
Redefine prompt
function on your profile:
[ScriptBlock]$Prompt = {
$err = $? ? 0 : 1
<go-my-posh> -config ~/jandedobbeleer.json -error $err
}
Set-Item -Path Function:prompt -Value $Prompt -Force
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
- Brew
- Chocolatey
- Create documentation on the different segments
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)