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="$?"
|
2023-09-15 06:34:04 +00:00
|
|
|
local row
|
|
|
|
local col
|
2023-09-12 18:19:52 +00:00
|
|
|
|
2023-09-15 06:34:04 +00:00
|
|
|
IFS=';' read -rs -dR -p $'\e[6n' row col >/dev/tty
|
|
|
|
if [[ $col != 1 ]]; then
|
|
|
|
printf '%s' $'\e[7m%\n\e[0m'
|
|
|
|
fi
|
|
|
|
|
|
|
|
PS1='\[\e[0;1m\]['
|
2023-09-12 18:19:52 +00:00
|
|
|
|
|
|
|
case $status in
|
|
|
|
0) PS1+='\[\e[36m\]' ;;
|
|
|
|
*) 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\]'
|
|
|
|
|
2023-09-19 12:31:35 +00:00
|
|
|
[[ $CONTAINER_ID ]] && PS1+="'"
|
2023-09-12 18:19:52 +00:00
|
|
|
|
|
|
|
PS1+=' '
|
|
|
|
}
|
|
|
|
PROMPT_COMMAND=__prompt
|