fishprompts.txt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. function fish_right_prompt
  2. date
  3. end
  4. function printtime --on-event fish_postexec
  5. set -l last_pipestatus $pipestatus
  6. set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
  7. set -l normal (set_color normal)
  8. set -q fish_color_status
  9. or set -g fish_color_status red
  10. set -l bold_flag --bold
  11. set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
  12. if test $__fish_prompt_status_generation = $status_generation
  13. set bold_flag
  14. end
  15. set __fish_prompt_status_generation $status_generation
  16. set -l status_color (set_color $fish_color_status)
  17. set -l statusb_color (set_color $bold_flag $fish_color_status)
  18. set -l prompt_status (__fish_print_pipestatus "⚰️ " "" "|" "$status_color" "$statusb_color" $last_pipestatus)
  19. echo ⏱️ (echo "$CMD_DURATION 1000" | awk '{printf "%.3fs", $1 / $2}') $prompt_status
  20. end
  21. function fish_prompt
  22. # Status decoration
  23. set -l last_status $status
  24. set -l stat
  25. if test $last_status -ne 0
  26. set stat (set_color red)"[$last_status]"(set_color normal)
  27. end
  28. # Git things
  29. set -g __fish_git_prompt_showupstream auto
  30. set -g __fish_git_prompt_showcolorhints true
  31. # Print the prompt
  32. string join '' -- (set_color green) (pwd) (set_color normal) (fish_git_prompt) $stat " ᕕ(ᐛ)ᕗ "
  33. end