fish_prompt.fish 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. function fish_prompt --description 'Write out the prompt'
  2. set -l last_status $status
  3. # User
  4. set_color $fish_color_user
  5. echo -n (whoami)
  6. set_color normal
  7. echo -n '@'
  8. # Host
  9. set_color $fish_color_host
  10. echo -n (prompt_hostname)
  11. set_color normal
  12. echo -n ':'
  13. # PWD
  14. set_color $fish_color_cwd
  15. echo -n (prompt_pwd)
  16. set_color normal
  17. # Second line
  18. echo
  19. # Error status
  20. if not test $last_status -eq 0
  21. set_color $fish_color_error
  22. echo -n '!'
  23. echo -n $last_status
  24. set_color normal
  25. end
  26. # Purpose
  27. set -q FISH_SHELL_PURPOSE
  28. if test $status -eq 0
  29. set_color normal
  30. echo -n '['
  31. else
  32. set_color white
  33. echo -n '[fish'
  34. end
  35. set_color blue
  36. echo -n $FISH_SHELL_PURPOSE
  37. set_color normal
  38. # VCS
  39. __terlar_git_prompt
  40. __fish_hg_prompt
  41. echo
  42. # Color arrow with error
  43. if not test $last_status -eq 0
  44. set_color $fish_color_error
  45. end
  46. echo -n '➤ '
  47. set_color normal
  48. end