add bash output colouring

This commit is contained in:
2025-05-25 00:53:12 +02:00
parent ef82d7c421
commit bad11579b5

View File

@@ -34,6 +34,13 @@ _lazy_ssh() {
alias ssh='_lazy_ssh; ssh'
alias sudo='_lazy_ssh; sudo'
# alias to colourize make output
_make() {
make "$@" 2> >(sed -E \
-e "s/^([Mm]akefile:[0-9]+:.*)/\x1b[33m\1\x1b[0m/" \
-e "s/^.*error.*$/\x1b[31m&\x1b[0m/I" >&2)
}
# set PS1
PS1=
PS1="$PS1"'\[\033[01;35m\]\u@\h' # user@host
@@ -80,7 +87,7 @@ alias ip='ip -c'
alias ncdu='ncdu --color=dark -t 16'
alias hyfetch='hyfetch --ascii-file $HOME/.config/hyfetch-ascii'
alias bat='bat --wrap never --tabs 4 --theme gruvbox-dark'
alias make='make -j'
alias make='_make -j'
# aliases to avoid mistakes
alias cp='cp -i'