dot

packages and services management
Log | Files | Refs | README

commit 86f2a57891464400aeef46024791631cf767c888
parent 894973949eb355a28c3089807efe63f4676c04d6
Author: Josuah Demangeon <mail@josuah.net>
Date:   Tue, 19 Dec 2017 20:16:32 +0100

PS1 is back

Diffstat:
Mbin/git-status | 24+++++++-----------------
Dbin/l | 4----
Mdot/profile | 3++-
3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/bin/git-status b/bin/git-status @@ -1,25 +1,22 @@ #!/bin/sh + git rev-parse 2> /dev/null || exit 1 git status --porcelain -b | awk ' - /^## / { branch = $0; sub(/^## /, "", branch); sub(/\.\.\..*/, "", branch); - if ($0 ~ /ahead /) { ahead = $0; sub(/.*ahead /, "", ahead); sub(/\].*|, .*/, "", ahead); } - if ($0 ~ /behind /) { behind = $0; sub(/.*behind /, "", behind); sub(/\].*|, .*/, "", behind); } - next; } @@ -34,19 +31,12 @@ git status --porcelain -b | awk ' END { printf("%s", branch); - - if (untracked) - printf(" \033[33m?\033[m%d", untracked); - if (conflicts) - printf(" \033[31mx\033[m%d", conflicts); - if (changed) - printf(" \033[32m+\033[m%d", changed); - if (staged) - printf(" \033[34m#\033[m%d", staged); - if (behind) - printf(" \033[35mv\033[m%d", behind); - if (ahead) - printf(" \033[35m^\033[m%d", ahead); + if (untracked) printf(" ?%d", untracked); + if (conflicts) printf(" x%d", conflicts); + if (changed) printf(" +%d", changed); + if (staged) printf(" #%d", staged); + if (behind) printf(" v%d", behind); + if (ahead) printf(" ^%d", ahead); }' [ -d "$(git rev-parse --git-dir)/rebase-merge" ] && printf ' rebase' diff --git a/bin/l b/bin/l @@ -1,4 +0,0 @@ -#!/bin/sh - -printf '\033[H\033[J\033[1m%s\033[m %s\n' "$PWD" "$(git-status)" -ls -p "$@" diff --git a/dot/profile b/dot/profile @@ -36,7 +36,8 @@ export SSH_AUTH_SOCK="$HOME/.cache/ssh-agent" export LESS="-~R" export LESSHISTFILE=- -export PS1="${SSH_TTY:+$(uname -n)}% " +export PS1="$(printf '\033]0;$PWD $(git-status)\a') +${SSH_TTY:+$(uname -n)}% " pgrep -qx ssh-agent || { mkdir -p "${SSH_AUTH_SOCK%/*}"