Advertisement
STGamer24

My Fish Shell prompt

Jun 25th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | Source Code | 0 0
  1. function fish_prompt
  2. set -l last_status $status
  3. set -l stat
  4. set -l input
  5.  
  6. if test $last_status -ne 0
  7. set stat (set_color -o brred)"[$last_status]"(set_color normal)
  8. if fish_is_root_user
  9. set input (set_color -o magenta)"❯❯ "
  10. else
  11. set input (set_color -o red)"❯ "
  12. end
  13. else
  14. if fish_is_root_user
  15. set stat (set_color -o green)"[$last_status]"(set_color bryellow)
  16. set input (set_color yellow)"❯❯ "
  17. else
  18. set stat (set_color -o brcyan)"[$last_status]"(set_color normal)
  19. set input (set_color brgreen)"❯ "
  20. end
  21. end
  22.  
  23. set -l place
  24. if string match -q -- '/mnt/c*' "$PWD"
  25. set place (wslpath -m "$PWD")
  26. else
  27. set place "$PWD"
  28. end
  29.  
  30. set -l private # this is just to hide my hostname
  31. set -l host
  32. if not set -q private
  33. set host (prompt_hostname)
  34. else
  35. set host "[hostname]"
  36. end
  37.  
  38. if fish_is_root_user
  39. echo (set_color red)'Fish: '(set_color -o brred)"root"(set_color normal)"@"(set_color red)"$host"
  40. echo (set_color -o magenta)"$place" "$stat" "$input"
  41. else
  42. echo (set_color bryellow)'Fish: '(set_color cyan)(whoami)(set_color normal)"@"(set_color magenta)"$host"
  43. echo (set_color -o brblue)"$place" "$stat" "$input"
  44. end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement