_pure_prompt_first_line.fish 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. function _pure_prompt_first_line \
  2. --description 'Print contextual information before prompt.'
  3. if not type -fq git # exit if git is not available
  4. return 1
  5. end
  6. set --local prompt_ssh (_pure_prompt_ssh)
  7. set --local prompt_git (_pure_prompt_git)
  8. set --local prompt_command_duration (_pure_prompt_command_duration)
  9. set --local prompt (_pure_print_prompt \
  10. $prompt_ssh \
  11. $prompt_git \
  12. $prompt_command_duration
  13. )
  14. set --local prompt_width (_pure_string_width $prompt)
  15. set --local current_folder (_pure_prompt_current_folder $prompt_width)
  16. set --local prompt_components
  17. if test $pure_begin_prompt_with_current_directory = true
  18. set prompt_components \
  19. $current_folder \
  20. $prompt_git \
  21. $prompt_ssh \
  22. $prompt_command_duration
  23. else
  24. set prompt_components \
  25. $prompt_ssh \
  26. $current_folder \
  27. $prompt_git \
  28. $prompt_command_duration
  29. end
  30. echo (_pure_print_prompt $prompt_components)
  31. end