Skip to content

Instantly share code, notes, and snippets.

@R3V1Z3
Created August 30, 2018 22:24
Show Gist options
  • Save R3V1Z3/b6e90a13dddd1ba5a9e16a87c3784486 to your computer and use it in GitHub Desktop.
Save R3V1Z3/b6e90a13dddd1ba5a9e16a87c3784486 to your computer and use it in GitHub Desktop.
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