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
|
|
|
|
2021-08-18 18:53:02 +00:00
|
|
|
t() {
|
|
|
|
case $1 in
|
|
|
|
u*) git -C ~/todo commit -am 'docs: update' && git -C ~/todo push ;;
|
|
|
|
p*) git -C ~/todo pull ;;
|
|
|
|
*) nvim ~/todo/todo ;;
|
|
|
|
esac
|
|
|
|
}
|
2017-12-15 11:01:42 +00:00
|
|
|
|
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-10-25 17:30:54 +00:00
|
|
|
if [[ "$PWD" == "$HOME" ]]; then
|
2021-06-03 15:33:38 +00:00
|
|
|
PS1+='~'
|
2021-10-25 17:30:54 +00:00
|
|
|
elif [[ "$PWD" == / ]]; then
|
|
|
|
PS1+=/
|
2021-06-03 15:33:38 +00:00
|
|
|
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"
|