1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-23 00:17:59 +00:00

Allow users to easily define LS_COLORS and LSCOLORS (#1546)

This commit is contained in:
Kaleb Elwert 2018-03-30 17:47:05 -07:00 committed by GitHub
parent a0977cb92e
commit 443021237a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,11 +76,14 @@ if is-callable 'dircolors'; then
alias ls='ls --group-directories-first' alias ls='ls --group-directories-first'
if zstyle -t ':prezto:module:utility:ls' color; then if zstyle -t ':prezto:module:utility:ls' color; then
# Call dircolors to define colors if they're missing
if [[ -z "$LS_COLORS" ]]; then
if [[ -s "$HOME/.dir_colors" ]]; then if [[ -s "$HOME/.dir_colors" ]]; then
eval "$(dircolors --sh "$HOME/.dir_colors")" eval "$(dircolors --sh "$HOME/.dir_colors")"
else else
eval "$(dircolors --sh)" eval "$(dircolors --sh)"
fi fi
fi
alias ls="${aliases[ls]:-ls} --color=auto" alias ls="${aliases[ls]:-ls} --color=auto"
else else
@ -89,11 +92,15 @@ if is-callable 'dircolors'; then
else else
# BSD Core Utilities # BSD Core Utilities
if zstyle -t ':prezto:module:utility:ls' color; then if zstyle -t ':prezto:module:utility:ls' color; then
# Define colors for BSD ls. # Define colors for BSD ls if they're not already defined
if [[ -z "$LSCOLORS" ]]; then
export LSCOLORS='exfxcxdxbxGxDxabagacad' export LSCOLORS='exfxcxdxbxGxDxabagacad'
fi
# Define colors for the completion system. # Define colors for the completion system if they're not already defined
if [[ -z "$LS_COLORS" ]]; then
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:' 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:'
fi
alias ls="${aliases[ls]:-ls} -G" alias ls="${aliases[ls]:-ls} -G"
else else