A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rkitover/sh-prompt-simple below:

rkitover/sh-prompt-simple: Simple, fast, nice looking and colorful prompt for busybox/(d)ash/ksh/bash/zsh with Git branch, optional Git status indicator and exit status. Much faster than other Git prompts on MSYS2/Cygwin/WSL.

This is a simple, lightweight, and nice looking prompt that runs quickly even in very slow shells like MSYS2, Cygwin and WSL.

It shows the short name of the current environment (distribution, OS, etc.,) the git branch when in a git checkout, the last command exit status (green checkmark for success and red X mark for non-zero exit) and an optional clean/dirty git status indicator.

This prompt is compatible with bash, zsh and some other POSIX sh implementations such as busybox, (d)ash, ksh, etc..

It's based on the Solarized Extravagant theme in bash-git-prompt.

I also made a PowerShell version of this prompt.

mkdir -p ~/source/repos
cd ~/source/repos
git clone https://github.com/rkitover/sh-prompt-simple

Somewhere in your shell startup file such as ~/.bashrc put something like this:

SPS_STATUS=1
. ~/source/repos/sh-prompt-simple/prompt.sh

. For bash I also recommend:

shopt -s checkwinsize
PROMPT_COMMAND='history -a'

.

To show a clean/dirty git status indicator, set this variable:

. This is disabled by default because it makes the prompt much slower on things like MSYS2/Cygwin, but it will work fine on Linux. You can also try it on MSYS2/Cygwin and see if the slowdown is acceptable for you.

You can turn it on or off without re-sourcing any files, so if it's particularly slow in a large repository you can just do:

, to turn it off.

It may be particularly slow when entering a repository, but after that it will be cached and the prompt will be much faster.

The prompt tries to detect bash/busybox/(d)ash/ksh and use zero-width escape sequences if found. If your shell does not support the \[ ... \] zero-width escape sequences, for example because you didn't turn on the fancy prompt feature in busybox, you can turn them off by setting:

, or force them on with:

. If you have a wide enough window, the prompt will work more or less ok without the escape sequences in shells that don't support them.

By default the window title is set to the domain of the host or the hostname if on a local network (only two full hostname parts, such as machine.localnet.) To turn this off set:

. This is a work in progress and I plan to expand this feature to allow for complex window titles using formats and evaluated variables/commands.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4