1
0
Fork 0

utility: add support for g-prefixed coreutils ls

pull/1786/head
Kaleb Elwert 5 years ago
parent 66b9ea7d44
commit cd3261df1c

@ -72,28 +72,41 @@ if zstyle -T ':prezto:module:utility' safe-ops; then
alias ln="${aliases[ln]:-ln} -i" alias ln="${aliases[ln]:-ln} -i"
fi fi
# ls function -define-coreutils-aliases {
if is-callable 'dircolors'; then # Prefix will either be g or empty. This is to account for GNU Coreutils being
# GNU Core Utilities # installed alongside BSD Coreutils
local prefix=$1
if zstyle -T ':prezto:module:utility:ls' dirs-first; then if zstyle -T ':prezto:module:utility:ls' dirs-first; then
alias ls="${aliases[ls]:-ls} --group-directories-first" alias ${prefix}ls="${aliases[${prefix}ls]:-${prefix}ls} --group-directories-first"
fi fi
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 # Call dircolors to define colors if they're missing
if [[ -z "$LS_COLORS" ]]; then if [[ -z "$LS_COLORS" ]]; then
if [[ -s "$HOME/.dir_colors" ]]; then if [[ -s "$HOME/.dir_colors" ]]; then
eval "$(dircolors --sh "$HOME/.dir_colors")" eval "$(${prefix}dircolors --sh "$HOME/.dir_colors")"
else else
eval "$(dircolors --sh)" eval "$(${prefix}dircolors --sh)"
fi fi
fi fi
alias ls="${aliases[ls]:-ls} --color=auto" alias ${prefix}ls="${aliases[${prefix}ls]:-${prefix}ls} --color=auto"
else else
alias ls="${aliases[ls]:-ls} -F" alias ${prefix}ls="${aliases[${prefix}ls]:-${prefix}ls} -F"
fi fi
}
# ls
# GNU Core Utilities
if is-callable 'gdircolors'; then
-define-coreutils-aliases g
alias ls="${aliases[gls]:-gls}"
elif is-callable 'dircolors'; then
-define-coreutils-aliases
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

Loading…
Cancel
Save