[utility] Use "our" ls colors in GNU too
They were only being applied to BSD. Also, GNU uses `LS_COLORS`, and BSD only uses `LSCOLORS`. Keeping these consistent, with same color scheme, in both GNU and BSD. Simplify arithmetic command expression without using `${var}` substitution, but `var` instead. The second construct does not fail if `var` is not defined, but defaults its value to `0` in that case.
This commit is contained in:
parent
1716ed6fea
commit
9d0851ed95
1 changed files with 6 additions and 6 deletions
|
@ -6,14 +6,16 @@
|
||||||
# Colours
|
# Colours
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ ! -z ${terminfo[colors]} ]] && (( ${terminfo[colors]} >= 8 )); then
|
if (( terminfo[colors] >= 8 )); then
|
||||||
|
|
||||||
# ls Colours
|
# ls Colours
|
||||||
if (( ${+commands[dircolors]} )); then
|
if (( ${+commands[dircolors]} )); then
|
||||||
# GNU
|
# GNU
|
||||||
if [[ -s ${HOME}/.dir_colors ]]; then
|
|
||||||
|
(( ! ${+LS_COLORS} )) && if [[ -s ${HOME}/.dir_colors ]]; then
|
||||||
eval "$(dircolors --sh ${HOME}/.dir_colors)"
|
eval "$(dircolors --sh ${HOME}/.dir_colors)"
|
||||||
else
|
else
|
||||||
eval "$(dircolors --sh)"
|
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=1;36:cd=1;33:su=30;41:sg=30;46:tw=30;42:ow=30;43'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias ls='ls --group-directories-first --color=auto'
|
alias ls='ls --group-directories-first --color=auto'
|
||||||
|
@ -21,12 +23,10 @@ if [[ ! -z ${terminfo[colors]} ]] && (( ${terminfo[colors]} >= 8 )); then
|
||||||
else
|
else
|
||||||
# BSD
|
# BSD
|
||||||
|
|
||||||
# colours for ls and completion
|
|
||||||
(( ! ${+LSCOLORS} )) && export LSCOLORS='exfxcxdxbxGxDxabagacad'
|
(( ! ${+LSCOLORS} )) && export LSCOLORS='exfxcxdxbxGxDxabagacad'
|
||||||
(( ! ${+LS_COLORS} )) && export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
|
|
||||||
|
|
||||||
# stock OpenBSD ls does not support colors at all, but colorls does.
|
# stock OpenBSD ls does not support colors at all, but colorls does.
|
||||||
if [[ $OSTYPE == openbsd* ]]; then
|
if [[ ${OSTYPE} == openbsd* ]]; then
|
||||||
if (( ${+commands[colorls]} )); then
|
if (( ${+commands[colorls]} )); then
|
||||||
alias ls='colorls -G'
|
alias ls='colorls -G'
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue