dotfiles/.config/fish/functions/fish_prompt.fish
2025-11-05 10:31:51 -05:00

26 lines
1.1 KiB
Fish

function fish_prompt
set -l last_status $status
set -l user
set -l dir
set -l git
set -l stat
set user (set_color magenta) '' (set_color black)(set_color -b magenta) ' ' (whoami) ' ' (set_color normal)(set_color magenta) '' (set_color normal)
set dir (set_color black)(set_color -b blue) '' (set_color -b blue) '  '(prompt_pwd) ' ' (set_color normal)(set_color blue) '' (set_color normal)
if test -n (fish_git_prompt | string collect --allow-empty)
set -g __fish_git_prompt_showdirtystate 1
set git (set_color black)(set_color -b cyan) '' (set_color -b cyan) '  '(fish_git_prompt) ' ' (set_color normal)(set_color cyan) '' (set_color normal)
else
set git ""
end
if test $last_status -ne 0
set stat (set_color black)(set_color -b red) '' (set_color -b red) "  " (set_color normal)(set_color red) '' (set_color normal)
else
set stat (set_color black)(set_color -b green) '' (set_color -b green) "  " (set_color normal)(set_color green) '' (set_color normal)
end
string join '' $user $dir $git $stat ' '
end