Add 'dots/' from commit 'f64b634dd8fbb2c8a2898c3b9d0acc9452e4d966'
git-subtree-dir: dots git-subtree-mainline:2ad98cde17git-subtree-split:f64b634dd8
This commit is contained in:
22
dots/.bashrc.d/prompt
Normal file
22
dots/.bashrc.d/prompt
Normal file
@@ -0,0 +1,22 @@
|
||||
# shellcheck shell=bash
|
||||
# vim: set ft=bash :
|
||||
|
||||
get_branch_name() {
|
||||
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|
||||
|| git rev-parse --short HEAD 2>/dev/null \
|
||||
|| echo 'some branch'
|
||||
}
|
||||
get_git_info() {
|
||||
git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
echo -e "($(get_branch_name))"
|
||||
}
|
||||
|
||||
if [[ $SSH_CONNECTION ]]; then
|
||||
PS1='\[\033[01;31m\]\u@\h\[\033[00m\] $(get_git_info)\W❭\[$(tput sgr0)\] '
|
||||
else
|
||||
PS1='\u $(get_git_info)\W❭\[$(tput sgr0)\] '
|
||||
fi
|
||||
|
||||
# Ellipsis when deep in directory
|
||||
export PROMPT_DIRTRIM=2
|
||||
export PS1
|
||||
Reference in New Issue
Block a user