update PAGER; remove color checks, there will always be color; move local source to the end of the file to override anything in the root bashrc
parent
957a2fff9e
commit
1ee1b4c11c
93
.bashrc
93
.bashrc
|
@ -12,12 +12,19 @@ if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi
|
|||
[[ -r "/usr/share/bash-completion/bash_completion" ]] && . "/usr/share/bash-completion/bash_completion"
|
||||
[[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] && . $HOME/.nix-profile/etc/profile.d/nix.sh || true
|
||||
[[ -e $HOME/.local/bin/git-prompt.sh ]] && . $HOME/.local/bin/git-prompt.sh || true
|
||||
[[ -e $HOME/.bash.local ]] && . $HOME/.bash.local || true
|
||||
|
||||
alias dotfiles='git --git-dir=$HOME/dotfiles.git/ --work-tree=$HOME'
|
||||
alias dotfiles='git --git-dir=$HOME/dev/dotfiles.git/ --work-tree=$HOME'
|
||||
|
||||
EDITOR=vim; export EDITOR
|
||||
PAGER=less; export PAGER
|
||||
LESS="-R"; export LESS
|
||||
if which most > /dev/null 2>&1 ; then
|
||||
PAGER=most
|
||||
else
|
||||
PAGER=less
|
||||
fi
|
||||
export PAGER
|
||||
DELTA_PAGER=less; export DELTA_PAGER
|
||||
|
||||
PATH=$HOME/.local/bin:$HOME/.cargo/bin:$HOME/go/bin:${KREW_ROOT:-$HOME/.krew}/bin:$PATH
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
|
@ -48,70 +55,30 @@ PROMPT_COMMAND="history -a"
|
|||
# that multiple logins do not overwrite each other's history
|
||||
shopt -s histappend
|
||||
|
||||
use_color=true
|
||||
|
||||
function _update_ps1() {
|
||||
PS1="$(powerline-go -colorize-hostname -modules "user,host,ssh,cwd,perms,git,jobs,exit" -error $?)"
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
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
|
||||
if type __git_ps1 > /dev/null 2>&1 ; then
|
||||
GIT_PS1_SHOWDIRTYSTATE=1
|
||||
GIT_PS1_SHOWSTASHSTATE=1
|
||||
GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||
GIT_PS1_SHOWUPSTREAM="auto"
|
||||
GIT_PS1_SHOWCOLORHINTS=1
|
||||
GIT_PS1_HIDE_IF_PWD_IGNORED=1
|
||||
PROMPT_COMMAND='__git_ps1 "\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]" "\\\$ "'
|
||||
else
|
||||
PS1='\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]\$ '
|
||||
fi
|
||||
fi
|
||||
|
||||
if which lsd > /dev/null 2>&1 ; then
|
||||
alias ls="lsd"
|
||||
else
|
||||
alias ls="ls --color=auto"
|
||||
fi
|
||||
alias grep='grep --colour=auto'
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias fgrep='fgrep --colour=auto'
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
|
||||
else
|
||||
if [[ ${EUID} == 0 ]] ; then
|
||||
# show root@ when we don't have colors
|
||||
PS1='\u@\h \W \$ '
|
||||
if type __git_ps1 > /dev/null 2>&1 ; then
|
||||
GIT_PS1_SHOWDIRTYSTATE=1
|
||||
GIT_PS1_SHOWSTASHSTATE=1
|
||||
GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||
GIT_PS1_SHOWUPSTREAM="auto"
|
||||
GIT_PS1_SHOWCOLORHINTS=1
|
||||
GIT_PS1_HIDE_IF_PWD_IGNORED=1
|
||||
PROMPT_COMMAND='__git_ps1 "\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]" "\\\$ "'
|
||||
else
|
||||
PS1='\u@\h \w \$ '
|
||||
PS1='\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]\$ '
|
||||
fi
|
||||
fi
|
||||
|
||||
unset use_color safe_term match_lhs sh
|
||||
if which lsd > /dev/null 2>&1 ; then
|
||||
alias ls="lsd"
|
||||
else
|
||||
alias ls="ls --color=auto"
|
||||
fi
|
||||
alias grep='grep --colour=auto'
|
||||
alias egrep='egrep --colour=auto'
|
||||
alias fgrep='fgrep --colour=auto'
|
||||
|
||||
xhost +local:root > /dev/null 2>&1
|
||||
|
||||
|
@ -142,3 +109,5 @@ ex ()
|
|||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
[[ -e $HOME/.bash.local ]] && . $HOME/.bash.local || true
|
||||
|
|
Reference in New Issue