Guest User

Untitled

a guest
Jan 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
  2. # ... or force ignoredups and ignorespace
  3. HISTCONTROL=ignoreboth
  4.  
  5. shopt -s histappend
  6. shopt -s checkwinsize
  7. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  8. . /etc/bash_completion
  9. fi
  10.  
  11. # enable color support of ls and also add handy aliases
  12. if [ -x /usr/bin/dircolors ]; then
  13. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  14. alias ls='ls --color=auto'
  15. #alias dir='dir --color=auto'
  16. #alias vdir='vdir --color=auto'
  17. alias grep='grep --color=auto'
  18. alias fgrep='fgrep --color=auto'
  19. alias egrep='egrep --color=auto'
  20. fi
  21.  
  22. c_reset='\[\033[0;32m\]'
  23. c_user='\[\033[0;37m\]'
  24. c_path='\[\033[0;36m\]'
  25. c_git_clean='\[\033[1;32m\]'
  26. c_git_dirty='\[\033[1;31m\]'
  27.  
  28. function git_prompt {
  29. if ! git rev-parse --git-dir > /dev/null 2>&1; then
  30. echo -en "\[\033]2;${USER}:${PWD/$HOME/~}\007\]"
  31. return 0
  32. fi
  33. git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
  34. if git diff --quiet 2>/dev/null >&2; then
  35. git_color="${c_git_clean}"
  36. else
  37. git_color=${c_git_dirty}
  38. fi
  39. echo -en "\[\033]2;GIT: $git_branch\007\]"
  40. echo " [$git_color$git_branch$c_reset]"
  41. }
  42.  
  43. function prompt_func() {
  44. prompt="[${c_user}\u${c_reset}]${c_path}\w${c_reset}$(git_prompt)\$ "
  45. PS1="${prompt}"
  46. }
  47.  
  48. PROMPT_COMMAND=prompt_func
Add Comment
Please, Sign In to add comment