templier-ansible/roles/cli-utils/templates/bashrc.j2

60 lines
1.3 KiB
Plaintext
Raw Normal View History

{{ ansible_header | comment }}
2021-01-29 00:08:39 +00:00
[ -z "$PS1" ] && return
HISTCONTROL=ignoredups:ignorespace
HISTFILE=/dev/null
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe.sh ] && eval "$(SHELL=/bin/sh lesspipe.sh)"
PROMPT_COMMAND=__prompt
__prompt() {
retline=$?
gitline=$(git branch 2> /dev/null | grep '^*' | awk '{print $2}')
# COLORS
RED='\[\e[01;31m\]'
GREEN='\[\e[01;32m\]'
ORANGE='\[\e[01;33m\]'
BLUE='\[\e[01;34m\]'
NC='\[\e[0m\]'
PS1=""
PS1+="$GREEN\u@\h$NC" # user@host
PS1+=" $BLUE\W$NC" # pwd
[ -z $gitline ] || PS1+=" $ORANGE$gitline$NC"
PS1="[ $PS1 ]"
[ $retline -ne 0 ] && PS1+=" $RED$retline$NC "
PS1+="\$ "
return $ret
}
if [ -f ~/.config/bash/bash_aliases ]; then
. ~/.config/bash/bash_aliases
fi
rm -rf {{ cliutils.bash.bogus_dirs | join(" ") }}
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
fi
export XDG_CONFIG_HOME=~/.config/
grep -q '/\.local/bin'<<<$PATH || export PATH=$PATH:~/.local/bin/
## REMOVING LESSHST
LESSHISTFILE=/dev/null
export EDITOR='vim'
export PASSWORD_STORE_ENABLE_EXTENSIONS=true