Guest User

Untitled

a guest
Dec 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. set fish_git_dirty_color red
  2. set fish_git_not_dirty_color green
  3.  
  4. function parse_git_branch
  5. set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
  6. set -l git_status (git status -s)
  7.  
  8. if test -n "$git_status"
  9. echo (set_color $fish_git_dirty_color)$branch(set_color normal)
  10. else
  11. echo (set_color $fish_git_not_dirty_color)$branch(set_color normal)
  12. end
  13. end
  14.  
  15. function fish_prompt
  16. set -l git_dir (git rev-parse --git-dir 2> /dev/null)
  17. if test -n "$git_dir"
  18. printf 'λ %s%s/%s %s ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (parse_git_branch)
  19. else
  20. printf 'λ %s%s/%s ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
  21. end
  22. end
Add Comment
Please, Sign In to add comment