add new bash options

This commit is contained in:
frosty 2024-05-29 06:20:41 -04:00
parent fcd660af27
commit a817a3153d

View file

@ -1,8 +1,29 @@
[ -z "$PS1" ] && return
[[ $- != *i* ]] && return
shopt -s autocd
shopt -s checkwinsize
shopt -s noclobber
shopt -s histappend
shopt -s cmdhist
PS1='\u@\h \w \$ '
HISTFILESIZE=100000
export HISTCONTROL="ignoredups"
git_branch() {
branch=$(git branch 2>/dev/null | grep '^*' | colrm 1 2)
if [ ! -z "$branch" ]; then
if [ -n "$(git status --porcelain)" ]; then
color="31" # Red for changes
elif [ "$(git stash list)" ]; then
color="33" # Yellow for stashed changes
else
color="32" # Green for a clean state
fi
echo -e "\\e[0;${color}m${branch}\\e[0m"
fi
}
PS1='\[\e[1;32m\]\u@\h \[\e[1;34m\]\w \$(git_branch) \[\e[0m\]\$ '
[ -f "$XDG_CONFIG_HOME/shell/shortcuts" ] && . "$XDG_CONFIG_HOME/shell/shortcuts"