rice/dots/.bashrc

50 lines
833 B
Bash
Raw Normal View History

2023-09-02 19:47:37 +00:00
shopt -s cdspell checkjobs extglob globstar histappend nocaseglob
HISTCONTROL=erasedups:ignorespace
2023-09-19 11:09:09 +00:00
alias db=distrobox
2023-09-02 19:47:37 +00:00
alias mkdir='mkdir -p'
alias rg='rg -S'
bind '"\C-o": "\C-a\C-k fg; if [[ $? == 1 ]]; then nvim; fi\n"'
bind '"\e\C-m": "\C-e | nvim\C-m"'
2023-09-12 18:19:52 +00:00
2023-11-28 08:52:49 +00:00
update() {
rpm-ostree upgrade
distrobox upgrade --all
rustup update
flatpak update
}
2023-09-12 18:19:52 +00:00
__prompt() {
2023-11-28 08:53:06 +00:00
local status="$?"
local row
local col
2023-09-12 18:19:52 +00:00
2023-11-28 08:53:06 +00:00
IFS=';' read -rs -dR -p $'\e[6n' row col >/dev/tty
if [[ $col != 1 ]]; then
printf '%s' $'\e[0;7m%\n\e[0m'
fi
2023-11-28 08:53:06 +00:00
PS1='\[\e[0;1m\]['
2023-09-12 18:19:52 +00:00
2023-11-28 08:53:06 +00:00
case $status in
0) PS1+='\[\e[32m\]' ;;
*) PS1+='\[\e[31m\]' ;;
esac
2023-09-12 18:19:52 +00:00
2023-11-28 08:53:06 +00:00
if [[ "$PWD" == "$HOME" ]]; then
PS1+="~"
elif [[ "$PWD" == / ]]; then
PS1+=/
else
PS1+="${PWD##*/}"
fi
2023-09-12 18:19:52 +00:00
2023-11-28 08:53:06 +00:00
PS1+='\[\e[0;1m\]]\[\e[0m\]'
2023-09-12 18:19:52 +00:00
2023-11-28 08:53:06 +00:00
[[ $CONTAINER_ID ]] && PS1+="'"
2023-09-12 18:19:52 +00:00
2023-11-28 08:53:06 +00:00
PS1+=' '
2023-09-12 18:19:52 +00:00
}
PROMPT_COMMAND=__prompt