Simple and configurable shell prompt program in C which can be used to make yourprompt the same on any shell.

Promptus is very simple, but has some convenience features for those who wantthem:
- Display of the PWD (enabled by default)
- Basename of PWD (enabled by default)
- Abbreviation of
$HOME
to~
(enabled by default) - Coloring of prompt based on exit code of previous program (enabled by default)
- Customizable color set
- Python venv prefix support
See config.h for configuration options.
Modify config.h to suit your needs and then domake
. Usemake install
toinstall andmake uninstall
to uninstall.
Simply running promptus is enough. IfPROMPT_STATUS
is enabled in config.h,pass the exit code of the previous process as the first argument (or don't,which allows you to disable this feature at runtime without rebuildingpromptus).
If you are using bash and want to use promptus for your prompt, this is howI would do it. Put this in your .bashrc:
export PROMPT_COMMAND=__prompt_commandifcommand -v promptus>/dev/null;then__prompt_command() { PS1="$(promptus$?)" }else__prompt_command() {# if you have a default prompt you'd like to use when promptus isn't# installed, you should set PS1 here }fi
If you are using zsh, things are a little weirder than bash, but work about thesame way. Try this:
ifcommand -v promptus>/dev/null;thenprecmd() { PROMPT="$(eval'promptus $?')" }fi# this won't get used if promptus is found aboveexport PROMPT="my cool prompt $"