From 6e59c19e84ce04fba6833585f8d47b6436ec79b4 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 4 Feb 2021 11:02:14 +0400 Subject: Added colors to .bashrc PS1 --- .bashrc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to '.bashrc') diff --git a/.bashrc b/.bashrc index 90d2d92..c25df19 100644 --- a/.bashrc +++ b/.bashrc @@ -2,12 +2,12 @@ if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - + alias gcc='gcc -fdiagnostics-color=always' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' + alias pacman='pacman --color=always' + alias yay='yay --color=always' fi # Aliases @@ -25,7 +25,17 @@ fzf_cd() { cd "$(find ~ -type d | fzf)" } +set_ps1() { + # red color if current user us root, otherwise - green + [ "$USER" = "root" ] && UCOLOR="\e[1;31m" || UCOLOR="\e[1;32m" + [ "$USER" = "root" ] && END="#" || END="$" + BLUE="\e[1;34m" + PURPLE="\e[1;35m" + STOP="\e[m" + export PS1="\A $UCOLOR\u$STOP@$PURPLE\h$STOP:$BLUE\w$STOP $END " +} + bind '"\C-f":"fzf_cd\n"' -export PS1="\A \u@\h:\w >\[$(tput sgr0)\] " +set_ps1 export TERM="xterm-256color" -- cgit v1.2.3