red user and hostname for root sessions

This commit is contained in:
Carlos Galindo 2021-02-06 19:04:09 +01:00
parent 9e11d79a1a
commit 2ce2815a4c
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,12 @@
function fish_prompt
set user (set_color --bold cyan)(whoami)(set_color normal)
if [ $USER = "root" ]
set user (set_color --bold red)(whoami)(set_color normal)
set machine (set_color --bold red)(hostname| cut -d . -f 1)(set_color normal)
else
set user (set_color --bold cyan)(whoami)(set_color normal)
set machine (set_color --bold blue)(hostname| cut -d . -f 1)(set_color normal)
end
set machine (set_color --bold blue)(hostname| cut -d . -f 1)(set_color normal)
set -l realhome ~
set directory (set_color --bold green)(echo $PWD | sed -e "s|^$realhome|~|")(set_color normal)