dot

packages and services management
Log | Files | Refs | README

commit 111f33c61faa7ae58dcf3513539dc47834a7ed6d
parent 089a4bd45c62c58d4df21c37175f7bbec78a6f1b
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Tue, 16 May 2017 10:11:10 +0200

prompt

Diffstat:
M.profile | 11+++--------
Mbin/git-status | 2+-
Abin/prompt | 10++++++++++
3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/.profile b/.profile @@ -77,14 +77,9 @@ export EDITOR VISUAL PAGER MANPAGER DVTM_PAGER BROWSER # prompts -PS1=' -$( - printf "\033[m" - date +"[%H:%M]" -) $USER@$(hostname) $PWD/$(git-status)${ABDUCO:+ $ABDUCO} ${?#0} -$(jobs | wc -l | sed s/0//)$([ "$USER" = root ] && printf \# || printf \$) ' -PS2=' > ' -PS3=' > ' +PS1='`prompt`' +PS2='> ' +PS3='> ' export PS1 PS2 PS3 diff --git a/bin/git-status b/bin/git-status @@ -30,7 +30,7 @@ git rev-parse 2> /dev/null && git status --porcelain -b | awk ' /^[^ ]. / { staged++; } END { - printf(" %s", branch); + printf("%s", branch); if (untracked) printf(" ?%d", untracked); if (conflicts) printf(" ยค%d", conflicts); diff --git a/bin/prompt b/bin/prompt @@ -0,0 +1,10 @@ +printf '\033[m\n' + +printf '[%s] %s@%s %s/' "`date +%H:%M`" "$USER" "`hostname`" "$PWD" + +for i in "`git-status`" "${ABDUCO}" "${1#0}" +do + [ "$i" ] && printf ' %s' "$i" +done + +[ "$USER" = root ] && printf '\n# ' || printf '\n$ '