RandomUsefulStuff/ultimate.bashrc

87 lines
1.9 KiB
Plaintext
Raw Normal View History

# ALWAYS RUN
# ==========
# things to always set up, even for inactive shells
# Fuck vi!
2021-05-11 16:36:15 +02:00
EDITOR=nano
# On FreeBSD this is being set for whatever reason in the other shell rc files. I'll leave it here for compatibility.
2021-05-11 16:36:15 +02:00
PAGER=less
2021-06-15 21:53:23 +02:00
# add a user-specific bin directory to PATH
PATH=$HOME/.local/bin:$PATH
2021-06-16 01:55:33 +02:00
export EDITOR PAGER PATH
2021-05-11 16:36:15 +02:00
# CHECK INTERACTIVE
# =================
# Don't do anything after this if not running an interactive shell.
2021-05-11 16:36:15 +02:00
case $- in
*i*) ;;
*) return ;;
esac
# ALIASES
# =======
alias ls="ls --color=auto"
alias la="ls -aF"
alias grep="grep --color=auto"
# BASH COMPLETION
# ===============
# include bash completions if they exist
# (may need to be adjusted to where the bash completions are stored on the current system)
# Default for FreeBSD:
if [ -f /usr/local/share/bash-completion/bash_completion.sh ]; then
source /usr/local/share/bash-completion/bash_completion.sh
# Default for Linux:
elif [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion
fi
# VARIABLES
# =========
# don't put duplicate lines or lines starting with a space in history
HISTCONTROL=ingnoreboth
# unlimited history
HISTSIZE=-1
HISTFILESIZE=-1
# set a fancy prompt
PROMPT_COMMAND="PS1=\"[\[\e[03$(
if [ $EUID -eq 0 ]
then
2021-05-16 22:30:45 +02:00
echo -n '1;02m'
else
if [ -n "$(groups | grep 'wheel\|sudo')" ];
2021-05-11 16:36:15 +02:00
then
2021-05-16 22:30:45 +02:00
echo -n '2;01m'
2021-05-11 16:36:15 +02:00
else
2021-05-16 22:30:45 +02:00
echo -n '6;01m'
fi
fi
)\]\u@\h\[\e[0m\]]:\$(
PROMPT_ERRORLEVEL=\$?
if [ \$PROMPT_ERRORLEVEL -eq 0 ]
then
echo -n '\[\e[032;02m\]'
else
echo -n '\[\e[031;02m\]'
fi
echo -n \$PROMPT_ERRORLEVEL
echo -n '\[\e[00m\]'
2021-05-16 22:30:45 +02:00
):\[\e[034;01m\]\$(pwd)\[\e[0m\]:$(
if [ $EUID -eq 0 ]
then
echo -n '\[\e[02m\]#\[\e[0m\]'
else
echo -n '\[\e[02m\]$\[\e[0m\]'
fi
)> \""
# SHELL OPTIONS
# =============
shopt -s histappend
shopt -s checkwinsize
shopt -s globstar