rice/dots/.bashrc

43 lines
829 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
__prompt() {
local status="$?"
local row
local col
2023-09-12 18:19:52 +00:00
IFS=';' read -rs -dR -p $'\e[6n' row col >/dev/tty
if [[ $col != 1 ]]; then
2023-09-27 12:48:15 +00:00
printf '%s' $'\e[0;7m%\n\e[0m'
fi
PS1='\[\e[0;1m\]['
2023-09-12 18:19:52 +00:00
case $status in
2023-09-27 12:48:15 +00:00
0) PS1+='\[\e[32m\]' ;;
2023-09-12 18:19:52 +00:00
*) PS1+='\[\e[31m\]' ;;
esac
2023-09-15 06:33:47 +00:00
if [[ "$PWD" == "$HOME" ]]; then
2023-09-12 18:19:52 +00:00
PS1+="~"
2023-09-15 06:33:47 +00:00
elif [[ "$PWD" == / ]]; then
2023-09-12 18:19:52 +00:00
PS1+=/
else
PS1+="${PWD##*/}"
fi
PS1+='\[\e[0;1m\]]\[\e[0m\]'
[[ $CONTAINER_ID ]] && PS1+="'"
2023-09-12 18:19:52 +00:00
PS1+=' '
}
PROMPT_COMMAND=__prompt