dots/.bashrc

29 lines
649 B
Bash
Raw Normal View History

2020-04-07 22:24:30 +02:00
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# load aliases dynamically
[ -f "$HOME/.aliasrc" ] && source "$HOME/.aliasrc"
2020-05-07 02:10:20 +02:00
# prompt
bold=$(tput bold)
reset=$(tput sgr0)
2020-04-08 21:22:00 +02:00
2020-05-07 02:10:20 +02:00
get_branch_name() {
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|| git rev-parse --short HEAD 2>/dev/null \
|| echo 'some branch'
}
2020-04-07 22:24:30 +02:00
2020-05-07 02:10:20 +02:00
get_git_info() {
git rev-parse --is-inside-work-tree &>/dev/null || return
echo -e "- ${1}$(get_branch_name)"
}
PS1='\[\033[38;5;244m\]\[${bold}\]$(get_git_info && echo "\n")\[${reset}\]\u \W $ '
2020-04-07 22:24:30 +02:00
# history
export HISTCONTROL=ignoreboth
2020-05-07 02:10:20 +02:00
# source fuzzy finder
source /usr/share/fzf/*.bash