Prmpt is a command prompt markup language.
The language is loosely modelled on the LaTeX markup language, used for typesetting.
Here is an example of the sort of interactive command prompt that can be built using prmpt:
The latest version can be installed from PyPI using pip
:
sudo pip install prmpt
You then need to insert a line at the end of your .bashrc
file so that prmpt is called from the PS1
environment variable:
prmpt -b >> ~/.bashrc
Now re-source your updated .bashrc
file:
source ~/.bashrc
(alternatively you can restart your shell session)
Tip: If you get an error like "
bash: prmpt: command not found
", it is probably because you installed it locally, as a non-root user (withoutsudo
). This is fine, but you will need to call the prmpt executable from its local path:
~/.local/bin/prmpt -b >> ~/.bashrc
The configuration for prmpt is defined in your ~/.local/share/prmpt/prmpt.cfg
file:
[prompt]
prompt_file = default.prmpt
The prompt_file
variable specifies which prmpt file is currently in use. The prmpt files are located in ~/.local/share/prmpt/
. You can change the configuration to use one of the pre-defined ones, or write your own.
You can define a simple .prmpt
file like this:
\green{\user}\space
\yellow{\hostname}\space
\blue[bold]{\workingdir}\space
\magenta[inverted]{(\repobranch )}\newline
\green[bold]{\unichar{0x27a5}}\space
And your prompt will end up looking like this:
Here is a verbose example with comments to explain the syntax used:
% comments are allowed
% and white-space does not matter!
% first the username
\lightblue{\user}
% then an @ symbol
@
% followed by the machine name
\green{\hostname}
% if we want an actual space, we do this:
\space
% now the working directory in a nice yellow.
% lets also make it bold!
\yellow[bold]{\workingdir}
\space
% now for the VCS repository branch
(\repobranch )
\space
% and finally we have the special $ sign
% (which actually turns into a # when you're root)
\dollar\space
This prmpt script will achieve the following prompt:
For a more elaborate example, see ~/.local/share/prmpt/default.prmpt
(this is the one used for the animation at the top of this page).
Documentation is available at readthedocs.