bashrc 912 B

12345678910111213141516171819202122232425262728293031323334353637
  1. source ~/dotfiles/shell/env
  2. # Only load interactive settings when in interactive shells.
  3. [[ $- != *i* ]] && return
  4. source ~/dotfiles/shell/common/load
  5. for file in ~/dotfiles/shell/bash/*.bash; do
  6. source $file
  7. done
  8. [[ -r ~/.bashlocal ]] && source ~/.bashlocal
  9. # Command Prompt
  10. #
  11. # [host] directory gitinfo jobinfo
  12. # user -
  13. #
  14. PROMPT_COMMAND='PS1="
  15. ${FG[6]}[\h] ${FG[3]}$(shortcwd)$(__gitp " %s")$(getajob)
  16. ${FG[5]}\u - $cReset"'
  17. # Display suspended/backgrounded job count, if any.
  18. function getajob() {
  19. local jobcount=$(jobs | wc -l)
  20. [[ $jobcount -ne 0 ]] && printf " ${FG[63]}[jobs]: ${FG[1]}\j" || printf ''
  21. }
  22. # Display up to 3 segments of the current working directory.
  23. function shortcwd() {
  24. local folder=$(pwd) fld='[^/]*'
  25. folder=${folder/$HOME/"~"}
  26. folder=$(echo $folder | sed 's|.*/\('$fld'/'$fld'/'$fld'\)|\1|')
  27. printf "$folder"
  28. }
  29. [ -f ~/.fzf.bash ] && source ~/.fzf.bash