Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom prompt for fish shell. Place in ~/.config/fish/functions
function fish_prompt
and set retc normal
or set retc red
tty | string match -q -r tty
and set tty tty
or set tty pts
set_color $retc
if [ $tty = tty ]
echo -n .-
else
echo -n '┬─'
end
set_color -o normal
echo -n [
if test "$USER" = root -o "$USER" = toor
set_color -o red
else
set_color -o white
end
echo -n "su"
set_color -o white
echo -n @
if [ -z "$SSH_CLIENT" ]
set_color -o blue
else
set_color -o cyan
end
echo -n "root" #(prompt_hostname)
set_color -o white
echo -n :(pwd|sed "s=$HOME=~=")
set_color -o normal
echo -n ']'
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 normal
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.