Skip to content

Commit 05f9968

Browse files
committed
bashrc: RL_IGNORE, fixed #8
1 parent 6b5509d commit 05f9968

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

bashrc

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,29 @@ for c in {e,f,}grep {v,}dir ls; do alias $c="$c --color=auto"; done;
5353

5454
# So they can be unset.
5555
_aosc_bashrc_colors='NORMAL RED GREEN CYAN IRED YELLOW'
56-
NORMAL='\[\e[0m\]'
57-
RED='\[\e[1;31m\]'
58-
GREEN='\[\e[1;32m\]'
59-
CYAN='\[\e[1;36m\]'
56+
NORMAL=$'\1\e[0m\2'
57+
RED=$'\1\e[1;31m\2'
58+
GREEN=$'\1\e[1;32m\2'
59+
CYAN=$'\1\e[1;36m\2'
6060

6161
# Linux tty color workaround
62-
[ "$(tput colors)" == 8 ] && YELLOW='\e[1;33m' IRED="\e[0;31m" || YELLOW='\e[1;93m' IRED="\e[0;91m"
62+
if [[ "$TERM" == linux ]]; then # && "$(tput colors)" == 8
63+
YELLOW=$'\1\e[1;33m' IRED=$'\1\e[0;31m\2'
64+
else
65+
YELLOW=$'\1\e[1;93m' IRED=$'\1\e[0;91m\2'
66+
fi
6367

6468
# A simple error level reporting function.
6569
# Loaded back to PS1
6670
_ret_prompt() {
6771
case $? in
68-
0|130) # Input C-c
69-
((EUID)) && printf '$' || printf '#' ;;
70-
127) # Command not found
71-
printf '\e[1;36m?'
72+
0|130) # Input C-c, we have to override the \$
73+
((EUID)) && echo -n '$' || echo -n '#';;
74+
127) # Command not found
75+
echo -ne '\1\e[1;36m\2?'
7276
;;
73-
*)
74-
printf $YELLOW'!'
77+
*) # Other errors
78+
echo -ne '\1'$YELLOW'\2!'
7579
;;
7680
esac
7781
}

0 commit comments

Comments
 (0)