Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to easily define LS_COLORS and LSCOLORS #1546

Merged
merged 1 commit into from
Mar 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions modules/utility/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ if is-callable 'dircolors'; then
alias ls='ls --group-directories-first'

if zstyle -t ':prezto:module:utility:ls' color; then
if [[ -s "$HOME/.dir_colors" ]]; then
eval "$(dircolors --sh "$HOME/.dir_colors")"
else
eval "$(dircolors --sh)"
# Call dircolors to define colors if they're missing
if [[ -z "$LS_COLORS" ]]; then
if [[ -s "$HOME/.dir_colors" ]]; then
eval "$(dircolors --sh "$HOME/.dir_colors")"
else
eval "$(dircolors --sh)"
fi
fi

alias ls="${aliases[ls]:-ls} --color=auto"
Expand All @@ -89,11 +92,15 @@ if is-callable 'dircolors'; then
else
# BSD Core Utilities
if zstyle -t ':prezto:module:utility:ls' color; then
# Define colors for BSD ls.
export LSCOLORS='exfxcxdxbxGxDxabagacad'
# Define colors for BSD ls if they're not already defined
if [[ -z "$LSCOLORS" ]]; then
export LSCOLORS='exfxcxdxbxGxDxabagacad'
fi

# Define colors for the completion system.
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:'
# 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:'
fi

alias ls="${aliases[ls]:-ls} -G"
else
Expand Down