2012-09-06 16:30:26 +08:00
|
|
|
|
# name: Nim
|
|
|
|
|
# author: Guilhem "Nim" Saurel − https://github.com/nim65s/dotfiles/
|
|
|
|
|
|
|
|
|
|
function fish_prompt
|
2016-11-02 10:19:45 +08:00
|
|
|
|
and set retc green
|
|
|
|
|
or set retc red
|
|
|
|
|
tty | string match -q -r tty
|
|
|
|
|
and set tty tty
|
|
|
|
|
or set tty pts
|
2012-09-06 16:30:26 +08:00
|
|
|
|
|
|
|
|
|
set_color $retc
|
|
|
|
|
if [ $tty = tty ]
|
|
|
|
|
echo -n .-
|
|
|
|
|
else
|
|
|
|
|
echo -n '┬─'
|
|
|
|
|
end
|
|
|
|
|
set_color -o green
|
|
|
|
|
echo -n [
|
2017-07-21 01:45:32 +08:00
|
|
|
|
if test "$USER" = root -o "$USER" = toor
|
2012-09-06 16:30:26 +08:00
|
|
|
|
set_color -o red
|
|
|
|
|
else
|
|
|
|
|
set_color -o yellow
|
|
|
|
|
end
|
|
|
|
|
echo -n $USER
|
|
|
|
|
set_color -o white
|
|
|
|
|
echo -n @
|
|
|
|
|
if [ -z "$SSH_CLIENT" ]
|
|
|
|
|
set_color -o blue
|
|
|
|
|
else
|
|
|
|
|
set_color -o cyan
|
|
|
|
|
end
|
2016-10-24 06:02:14 +08:00
|
|
|
|
echo -n (prompt_hostname)
|
2012-09-06 16:30:26 +08:00
|
|
|
|
set_color -o white
|
|
|
|
|
#echo -n :(prompt_pwd)
|
|
|
|
|
echo -n :(pwd|sed "s=$HOME=~=")
|
|
|
|
|
set_color -o green
|
|
|
|
|
echo -n ']'
|
|
|
|
|
set_color normal
|
|
|
|
|
set_color $retc
|
|
|
|
|
if [ $tty = tty ]
|
|
|
|
|
echo -n '-'
|
|
|
|
|
else
|
|
|
|
|
echo -n '─'
|
|
|
|
|
end
|
|
|
|
|
set_color -o green
|
|
|
|
|
echo -n '['
|
|
|
|
|
set_color normal
|
|
|
|
|
set_color $retc
|
|
|
|
|
echo -n (date +%X)
|
|
|
|
|
set_color -o green
|
|
|
|
|
echo -n ]
|
2016-11-02 10:19:45 +08:00
|
|
|
|
|
2016-03-20 19:20:39 +08:00
|
|
|
|
if type -q acpi
|
2016-11-02 10:19:45 +08:00
|
|
|
|
if [ (acpi -a 2> /dev/null | string match -r off) ]
|
|
|
|
|
echo -n '─['
|
|
|
|
|
set_color -o red
|
|
|
|
|
echo -n (acpi -b|cut -d' ' -f 4-)
|
|
|
|
|
set_color -o green
|
|
|
|
|
echo -n ']'
|
|
|
|
|
end
|
|
|
|
|
end
|
2012-09-06 16:30:26 +08:00
|
|
|
|
echo
|
|
|
|
|
set_color normal
|
|
|
|
|
for job in (jobs)
|
|
|
|
|
set_color $retc
|
|
|
|
|
if [ $tty = tty ]
|
|
|
|
|
echo -n '; '
|
|
|
|
|
else
|
|
|
|
|
echo -n '│ '
|
|
|
|
|
end
|
|
|
|
|
set_color brown
|
|
|
|
|
echo $job
|
|
|
|
|
end
|
|
|
|
|
set_color normal
|
|
|
|
|
set_color $retc
|
|
|
|
|
if [ $tty = tty ]
|
|
|
|
|
echo -n "'->"
|
|
|
|
|
else
|
|
|
|
|
echo -n '╰─>'
|
|
|
|
|
end
|
|
|
|
|
set_color -o red
|
|
|
|
|
echo -n '$ '
|
|
|
|
|
set_color normal
|
|
|
|
|
end
|