Introduction to Simple Bash Prompt (SBP)
Simple Bash Prompt, or SBP, is a lightweight and efficient shell prompt for bash users that began as an innovative twist on the popular powerline-shell. Initially inspired by powerline-shell, which is built with Python, SBP differentiates itself by being entirely constructed in Bash, offering greater speed and enjoyment for those familiar with the Bash scripting environment.
For those eager to see SBP in action, a live demonstration can be viewed here.
System Requirements
Hard Requirements
To utilize SBP, users must have Bash version 4.3 or higher installed on their system.
Soft Requirements
For users desiring the visually appealing pointy segment separators, powerline fonts must be installed and enabled. These fonts can be obtained here, with guidance for installation included. It's crucial to adjust terminal emulator settings, such as in "Settings" under "Fonts". If you'd rather avoid powerline aesthetics, alternative themes like 'plain' or 'lines' are available, or you can even create your own. Users of the Kitty terminal will find everything operates seamlessly without additional configuration.
For Developers
For those interested in contributing or customizing SBP, local development tools like pre-commit, shellcheck, bats, and shfmt are beneficial.
Installation Process
Using Git and the Install Script
After cloning the SBP repository, an install script is available at bin/install
. Executing this script will insert two lines into your $HOME/.bashrc
file:
SBP_PATH=/the/path/to/sbp
source ${SBP_PATH}/sbp.bash
Alternatively, these lines can be manually added to any preferred bash configuration file. Note that the default setup uses the master branch, which may offer less stability than other branches.
Usage Instructions
Once installed, starting with SBP requires no additional steps. However, users have the option to customize their experience by editing configuration files through the command sbp edit config
and reloading changes with sbp reload
. Various commands are available to enhance user interaction with SBP:
Usage: sbp [command]
Commands:
reload - Reload SBP and user settings
status - Display the current configuration
help - Provides help text
list
config - Lists all current settings
segments - Shows all available segments
hooks - Displays all available hooks
themes - Presents all available color themes and layouts
edit
config - Opens SBP configuration in $EDITOR
colors - Opens the colors configuration in $EDITOR
set
color - Sets [color] for the current session
layout - Sets [layout] for the current session
toggle
peekaboo - Toggles execution of [segment] or [hook]
debug - Activates or deactivates debug mode
Features Overview
Segments
Segments within SBP can be customized, rearranged, or hidden based on user preferences and context. More details about creating and managing segments can be found in the Segments Folder.
Hooks
Hooks allow users to run scripts asynchronously, enabling alerts or data preparation as required. Users can find additional information and guidance for creating custom hooks in the Hooks Folder.
Colors and Layouts
The aesthetic appeal of SBP is highly customizable with options for colors and layouts. More detailed instructions are provided in the Colors and Layouts folders. SBP supports both RGB truecolors and ANSI 256-color schemes, accommodating a wide range of user preferences through Xresources or their own setups.
FAQ
Is SBP purely Bash?
While SBP primarily relies on Bash, it occasionally interacts with other command-line applications such as git for enhanced functionality.
Why doesn't my prompt display any colors?
This issue may occur if the terminal being used does not support truecolors, such as OSX's Terminal.app. Users can opt for an ANSI theme or choose between the provided default-256 or xresources options.
Can I enjoy SBP without fancy fonts?
Certainly! By selecting the 'plain' layout, users can achieve simplicity without additional fonts. Furthermore, the Kitty terminal compensates for most character requirements.
How can I expedite the git segment for large repositories?
For improved performance in large repositories, users can enter the commands:
$ git config core.fsmonitor true
$ git config core.untrackedcache true
SBP aims to enhance the Bash experience by providing a prompt that is customizable, efficient, and a joy to work with for developers and command-line enthusiasts alike.