My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fish_prompt.fish 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. function fish_prompt --description 'Write out the prompt'
  2. if not set -q __fish_git_prompt_show_informative_status
  3. set -g __fish_git_prompt_show_informative_status 1
  4. end
  5. if not set -q __fish_git_prompt_hide_untrackedfiles
  6. set -g __fish_git_prompt_hide_untrackedfiles 1
  7. end
  8. if not set -q __fish_git_prompt_color_branch
  9. set -g __fish_git_prompt_color_branch magenta --bold
  10. end
  11. if not set -q __fish_git_prompt_showupstream
  12. set -g __fish_git_prompt_showupstream "informative"
  13. end
  14. if not set -q __fish_git_prompt_char_upstream_ahead
  15. set -g __fish_git_prompt_char_upstream_ahead "↑"
  16. end
  17. if not set -q __fish_git_prompt_char_upstream_behind
  18. set -g __fish_git_prompt_char_upstream_behind "↓"
  19. end
  20. if not set -q __fish_git_prompt_char_upstream_prefix
  21. set -g __fish_git_prompt_char_upstream_prefix ""
  22. end
  23. if not set -q __fish_git_prompt_char_stagedstate
  24. set -g __fish_git_prompt_char_stagedstate "●"
  25. end
  26. if not set -q __fish_git_prompt_char_dirtystate
  27. set -g __fish_git_prompt_char_dirtystate "✚"
  28. end
  29. if not set -q __fish_git_prompt_char_untrackedfiles
  30. set -g __fish_git_prompt_char_untrackedfiles "…"
  31. end
  32. if not set -q __fish_git_prompt_char_conflictedstate
  33. set -g __fish_git_prompt_char_conflictedstate "✖"
  34. end
  35. if not set -q __fish_git_prompt_char_cleanstate
  36. set -g __fish_git_prompt_char_cleanstate "✔"
  37. end
  38. if not set -q __fish_git_prompt_color_dirtystate
  39. set -g __fish_git_prompt_color_dirtystate blue
  40. end
  41. if not set -q __fish_git_prompt_color_stagedstate
  42. set -g __fish_git_prompt_color_stagedstate yellow
  43. end
  44. if not set -q __fish_git_prompt_color_invalidstate
  45. set -g __fish_git_prompt_color_invalidstate red
  46. end
  47. if not set -q __fish_git_prompt_color_untrackedfiles
  48. set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
  49. end
  50. if not set -q __fish_git_prompt_color_cleanstate
  51. set -g __fish_git_prompt_color_cleanstate green --bold
  52. end
  53. set -l last_status $status
  54. if not set -q __fish_prompt_normal
  55. set -g __fish_prompt_normal (set_color normal)
  56. end
  57. set -l color_cwd
  58. set -l prefix
  59. switch $USER
  60. case root toor
  61. if set -q fish_color_cwd_root
  62. set color_cwd $fish_color_cwd_root
  63. else
  64. set color_cwd $fish_color_cwd
  65. end
  66. set suffix '#'
  67. case '*'
  68. set color_cwd $fish_color_cwd
  69. set suffix '$'
  70. end
  71. # PWD
  72. set_color $color_cwd
  73. echo -n (prompt_pwd)
  74. set_color normal
  75. printf '%s ' (__fish_vcs_prompt)
  76. if not test $last_status -eq 0
  77. set_color $fish_color_error
  78. end
  79. echo -n "$suffix "
  80. set_color normal
  81. end