commit 58e895065f94742bc8b6a898f50a8a38721f0ed8
parent 56ce0bd24e6b2ac106679c041f16b4c7fdbe50d8
Author: hhvn <dev@hhvn.uk>
Date: Sun, 2 Jan 2022 16:17:14 +0000
.rcrc: use ~ for checking $__prompt_diff
Diffstat:
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/.rcrc b/.rcrc
@@ -30,13 +30,8 @@ fn __prompt {
# unstaged changes
__prompt_diff = ``(''){git diff >[2]/dev/null}
__prompt_diffstatus = $bqstatus
- if (echo $__prompt_diff | grep '.' >/dev/null) {
- if (echo $__prompt_diff | grep '.' >/dev/null) {
- tput setaf 8
- } else {
- tput setaf 15
- }
-
+ if (~ $__prompt_diff ?*) {
+ tput setaf 8
printf '%s+' `{echo $__prompt_diff |
grep '-E'^$__prompt_gnu_binary '^(\+\+\+|---)' |
sed -E 's~^[^a]*a/|^[^b]*b/~~' |