1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2026-04-18 14:24:06 +00:00

utility: Avoid multiple ls --version calls per shell startup

This commit is contained in:
Indrajit Raychaudhuri
2026-03-22 01:40:07 -05:00
parent 8de38fb59b
commit 9916799a0d

View File

@@ -76,7 +76,9 @@ if zstyle -T ':prezto:module:utility' safe-ops; then
fi
# ls
if [[ ${(@M)${(f)"$(ls --version 2>&1)"}:#*(GNU|lsd|uutils) *} ]]; then
_ls_version="$(ls --version 2>&1)"
if [[ ${(@M)${(f)_ls_version}:#*(GNU|lsd|uutils) *} ]]; then
# GNU Core Utilities
if zstyle -T ':prezto:module:utility:ls' dirs-first; then
@@ -123,10 +125,12 @@ alias lt='ll -tr' # Lists sorted by date, most recent last.
alias lc='lt -c' # Lists sorted by date, most recent last, shows change time.
alias lu='lt -u' # Lists sorted by date, most recent last, shows access time.
if [[ ${(@M)${(f)"$(ls --version 2>&1)"}:#*GNU *} ]]; then
if [[ ${(@M)${(f)_ls_version}:#*GNU *} ]]; then
alias lx='ll -XB' # Lists sorted by extension (GNU only).
fi
unset _ls_version
# Grep
if zstyle -t ':prezto:module:utility:grep' color; then
export GREP_COLOR=${GREP_COLOR:-'37;45'} # BSD.