2021-04-26 15:37:11 +00:00
|
|
|
# exit if not run interactively
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
2017-12-15 11:01:42 +00:00
|
|
|
shopt -s cdspell checkjobs extglob globstar histappend nocaseglob
|
|
|
|
HISTCONTROL=erasedups:ignorespace
|
|
|
|
HISTFILE="$XDG_CACHE_HOME/bash_history"
|
|
|
|
|
2021-06-03 14:26:34 +00:00
|
|
|
alias ..='cd ..'
|
|
|
|
alias cd..='cd ..'
|
2017-12-15 11:01:42 +00:00
|
|
|
alias htop='htop -t'
|
|
|
|
alias mkdir='mkdir -p'
|
|
|
|
alias rg='rg -S'
|
2021-06-03 15:04:33 +00:00
|
|
|
alias v='f -e nvim'
|
2017-12-15 11:01:42 +00:00
|
|
|
|
|
|
|
t() {
|
|
|
|
if [[ $1 ]]; then
|
|
|
|
mkdir -p "/tmp/$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "/tmp/$1"
|
|
|
|
}
|
|
|
|
|
2021-06-03 15:33:38 +00:00
|
|
|
eval "$(fasd --init auto)"
|
|
|
|
_fasd_bash_hook_cmd_complete v
|
|
|
|
|
|
|
|
eval "$(direnv hook bash)"
|
|
|
|
|
2017-12-15 11:01:42 +00:00
|
|
|
__prompt() {
|
|
|
|
case $? in
|
2021-06-03 15:33:38 +00:00
|
|
|
0) PS1='\[\e[34m\]' ;;
|
|
|
|
*) PS1='\[\e[31m\]' ;;
|
2017-12-15 11:01:42 +00:00
|
|
|
esac
|
|
|
|
|
2021-06-03 15:33:38 +00:00
|
|
|
if [[ "$PWD" = "$HOME" ]]; then
|
|
|
|
PS1+='~'
|
|
|
|
else
|
|
|
|
PS1+="${PWD##*/}"
|
|
|
|
fi
|
2021-06-03 15:04:33 +00:00
|
|
|
|
2021-06-03 15:33:38 +00:00
|
|
|
PS1+='\[\e[0m\] '
|
|
|
|
}
|
|
|
|
PROMPT_COMMAND="__prompt;$PROMPT_COMMAND"
|