Created
October 5, 2018 18:54
-
-
Save Berkmann18/5da3514bd3f2a019187c859629bf976b to your computer and use it in GitHub Desktop.
Bash RC (for Arch)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && exit | |
setxkbmap -layout gb | |
[[ "$PS1" ]] && echo -e "\e[0;33m$(fortune)\e[0m" | |
[[ -f ~/.aliases ]] && source ~/.aliases | |
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases | |
[[ -f ~/.extend.bashrc ]] && source ~/.extend.bashrc | |
[[ -r /usr/share/bash-completion/bash_completion ]] && /usr/share/bash-completion/bash_completion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_color=true | |
# Set colorful PS1 only on colorful terminals. | |
# dircolors --print-database uses its own built-in database | |
# instead of using /etc/DIR_COLORS. Try to use the external file | |
# first to take advantage of user additions. Use internal bash | |
# globbing instead of external grep binary. | |
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM | |
match_lhs="" | |
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" | |
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" | |
[[ -z ${match_lhs} ]] \ | |
&& type -P dircolors >/dev/null \ | |
&& match_lhs=$(dircolors --print-database) | |
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true | |
PROMPT_COMMAND='echo -ne "\033]0; $HOSTNAME: $PWD\007" ' | |
if ${use_color} ; then | |
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 | |
if type -P dircolors >/dev/null ; then | |
if [[ -f ~/.dir_colors ]] ; then | |
eval $(dircolors -b ~/.dir_colors) | |
elif [[ -f /etc/DIR_COLORS ]] ; then | |
eval $(dircolors -b /etc/DIR_COLORS) | |
fi | |
fi | |
if [[ ${EUID} == 0 ]] ; then | |
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' | |
else | |
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' | |
fi | |
else | |
if [[ ${EUID} == 0 ]] ; then | |
# show root@ when we don't have colors | |
PS1='\u@\h \W \$ ' | |
else | |
PS1='\u@\h \w \$ ' | |
fi | |
fi | |
unset use_color safe_term match_lhs sh | |
xhost +local:root > /dev/null 2>&1 | |
complete -cf sudo | |
# Bash won't get SIGWINCH if another process is in the foreground. | |
# Enable checkwinsize so that bash will check the terminal size when | |
# it regains control. #65623 | |
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11) | |
shopt -s checkwinsize | |
shopt -s expand_aliases | |
shopt -u extdebug | |
# export QT_SELECT=4 | |
# Enable history appending instead of overwriting. #139609 | |
shopt -s histappend | |
# better yaourt colors | |
export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35" | |
man() { | |
LESS_TERMCAP_md=$'\e[01;36;40m' \ | |
LESS_TERMCAP_me=$'\e[0m' \ | |
LESS_TERMCAP_so=$'\e[01;44;33m' \ | |
LESS_TERMCAP_se=$'\e[0m' \ | |
LESS_TERMCAP_us=$'\e[01;32m' \ | |
LESS_TERMCAP_ue=$'\e[0m' \ | |
#[[ $width -gt $MANWIDTH ]] && width=$MANWIDTH | |
command man "$@" | |
} | |
# Powerline | |
if command -v powerline-daemon > /dev/null; then | |
powerline-daemon -q | |
POWERLINE_BASH_CONTINUATION=1 | |
POWERLINE_BASH_SELECT=1 | |
. $PY3_PKG/powerline/bindings/bash/powerline.sh | |
fi | |
# Awesome fonts activation | |
source ~/.fonts/*.sh | |
settitle() { | |
if [ -n "$1" ]; then | |
PROMPT_COMMAND='echo -ne "\033]0;$1\a"' | |
else | |
PROMPT_COMMAND='echo -ne "\033]0;Terminal - $HOSTNAME\a"' | |
fi | |
} | |
calc() { | |
bc -l <<< "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment