Advertisement
kajacx

git-prompt.sh

Aug 10th, 2020
1,482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.44 KB | None | 0 0
  1. if test -f ~/.config/git/git-prompt.sh
  2. then
  3.     . ~/.config/git/git-prompt.sh
  4. else
  5.     PS1='\[\033]0;\W\007\]'        # set window title
  6.     PS1="$PS1"'\n'                 # new line
  7.     PS1="$PS1"'\[\033[32m\]'       # change to green
  8.     PS1="$PS1"'\u@\h '             # user@host<space>
  9.     PS1="$PS1"'\[\033[33m\]'       # change to brownish yellow
  10.     PS1="$PS1"'\w'                 # current working directory
  11.     if test -z "$WINELOADERNOEXEC"
  12.     then
  13.         GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
  14.         COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
  15.         COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
  16.         COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
  17.         if test -f "$COMPLETION_PATH/git-prompt.sh"
  18.         then
  19.             . "$COMPLETION_PATH/git-completion.bash"
  20.             . "$COMPLETION_PATH/git-prompt.sh"
  21.             PS1="$PS1"'\[\033[36m\]'  # change color to cyan
  22.             PS1="$PS1"'`__git_ps1`'   # bash function
  23.         fi
  24.     fi
  25.     PS1="$PS1"'\n'                 # new line
  26.     PS1="$PS1"'\[\033[1;31m\]'     # change color to red
  27.     PS1="$PS1"'$ '                 # prompt: always $
  28.     PS1="$PS1"'\[\033[36m\]'       # change color to cyan //0 for white
  29. fi
  30.  
  31. MSYS2_PS1="$PS1"               # for detection by MSYS2 SDK's bash.basrc
  32.  
  33. # Evaluate all user-specific Bash completion scripts (if any)
  34. if test -z "$WINELOADERNOEXEC"
  35. then
  36.     for c in "$HOME"/bash_completion.d/*.bash
  37.     do
  38.         # Handle absence of any scripts (or the folder) gracefully
  39.         test ! -f "$c" ||
  40.         . "$c"
  41.     done
  42. fi
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement