Files
dotfiles/archive/fish/functions/fish_prompt.fish

27 lines
746 B
Fish

function fish_prompt
# $status gets nuked as soon as something else is run, e.g. set_color
# so it has to be saved asap.
set -l last_status $status
fish_prompt_colors
# Clear the line because fish seems to emit the prompt twice. The initial
# display, then when you press enter.
# printf "\033[K"
# Current Directory
# 1st sed for colourising forward slashes
# 2nd sed for colourising the deepest path (the 'm' is the last char in the
# ANSI colour code that needs to be stripped)
printf $c1
printf (prompt_pwd | sed "s,/,$c0/$c1,g" | sed "s,\(.*\)/[^m]*m,\1/$c3,")
if test ! $last_status = "0"
printf $ce
else
printf $c4
end
printf " > "
printf $c4
end