mirror of
https://codeberg.org/frosty/dotfiles.git
synced 2024-09-19 03:37:10 -04:00
add new bash options
This commit is contained in:
parent
fcd660af27
commit
a817a3153d
25
bash/.bashrc
25
bash/.bashrc
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue