A dynamically changing prompt for Bash shell.
Current version: 0.6
- Support for git project folders
- Shows the current branch name
- Shows a colored symbol representing the status of the branch (no changes, modified, conflicted)
- Configuration file for customizing prompt output
- Configurable prompt schemes (default and scheme #1)
Just run the install.sh
file that can be found in the root folder.
user1@computer:~/dynamic-bash-prompt$ ls
total 12
-rwxrwxr-x 1 user1 user1 1779 nov 25 12:03 install.sh
-rw-rw-r-- 1 user1 user1 30 nov 25 10:16 readme.md
drwxrwxr-x 2 user1 user1 4096 nov 25 12:07 src
user1@computer:~/dynamic-bash-prompt$ ./install
Installing script in /home/user1...
Modifying .bashrc...
[INFO]: Please restart BASH session in order to correctly import changes.
user1@computer:~/dynamic-bash-prompt$
dyn_prompt_off
: Disables the dynamic promptdyn_prompt_on
: Enables the dynamic promptdyn_reload_config
: Reloads the script with the configuration filedyn_change_scheme
: Selects the specified scheme
Some parameters can be configured before importing this script. When installing
the script, a default configuration file .cfg_dynamic_prompt
is created
in the $HOME
folder with a sample (default) configuration.
-
DYN_PROMPT_BRANCH_COLOR
is an array or color numbers for branch names. By default, branch names are taken from git flow. Real, visual color might change depending on terminal configuration. -
DYN_PROMPT_BRANCH_DEFAULT_COLOR
is the color number used when the branch name does not match any of the predefined names in the previous array. -
DYN_PROMPT_BRANCH_STATUS
is an array of colors and symbols to indicate the current status. -
DYN_PROMPT_BRANCH_SEPARATOR
is a string used as a separator between your prompt and the branch indicator. -
DYN_PROMPT_BRANCH_BEGIN
andDYN_PROMPT_BRANCH_END
are two characters used to wrap the branch+status indicator, usually[
and]
,(
and)
... -
DYN_PROMPT_SCHEME
is number that determines the prompt scheme to use. For the moment only 2 schemes are available: default and #1. -
DYN_SEPARATOR_CHAR
is the character (and color) used to separate the prompt from the previous output in some of the prompt schemes.
Probably you will need some experimentation with these variables to suite your taste. For example, you might prefer:
DYN_PROMPT_BRANCH_SEPARATOR=" | "
DYN_PROMPT_BRANCH_BEGIN=" "
DYN_PROMPT_BRANCH_END=" "
For the moment there are only 2 available schemes: default and #1.
- Imanol Barberia ([email protected]) - Original author
- Francesc Rocher ([email protected]) - Added configurable values