bashrc 824 B

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