Skip to content

Instantly share code, notes, and snippets.

@P4z
Created April 22, 2016 21:24
Show Gist options
  • Save P4z/187f04225c4b3b56cb5577f56e9a377b to your computer and use it in GitHub Desktop.
Save P4z/187f04225c4b3b56cb5577f56e9a377b to your computer and use it in GitHub Desktop.
/etc/fish/fish_prompt
function fish_prompt
#and set retc green; or set retc red
set lastexit $status
if test $lastexit = 0
set retc green
else
set retc red
end
tty|grep -q tty; and set tty tty; or set tty pts
set_color $retc
if [ $tty = tty ]
echo -n .-
else
echo -n '┬─'
end
if [ $lastexit != 0 ]
echo -n '('$lastexit')'
if [ $tty = tty ]
echo -n '-'
else
echo -n '─'
end
end
set_color $retc
echo -n '['
if test $USER = root -o $USER = toor
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
echo -n (hostname)
set_color -o white
#echo -n :(prompt_pwd)
echo -n :(pwd|sed "s=$HOME=~=")
set_color $retc
echo -n ']'
set_color normal
set_color $retc
if [ $tty = tty ]
echo -n '-'
else
echo -n '─'
end
set_color $retc
echo -n '['
set_color -o green
echo -n (date +%H:%M:%S)
set_color $retc
echo -n ']'
# Check if acpi exists
if not set -q __fish_nim_prompt_has_acpi
if type acpi > /dev/null
set -g __fish_nim_prompt_has_acpi ''
else
set -g __fish_nim_prompt_has_acpi '' # empty string
end
end
if test "$__fish_nim_prompt_has_acpi"
if [ (acpi -a 2> /dev/null | grep off) ]
set_color $retc
echo -n '─['
set_color -o red
echo -n (acpi -b|cut -d' ' -f 4-)
set_color $retc
echo -n ']'
end
end
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment