From cd12f7689898582a2e7982e65362a9e16e76048c Mon Sep 17 00:00:00 2001 From: Kaspar Vollenweider Date: Sat, 19 Oct 2019 15:29:27 +0200 Subject: [PATCH] fix(alias): ls alias lx is an illegal option on MacOS/BSD The option `-X` lets MacOS (and probably also other BSD-ish OS) ls complain about an illegal option: ``` ls -lhXB ls: illegal option -- X usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] ``` --- modules/utility/init.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index caa0ec8d41..eeaa00dda7 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -118,13 +118,17 @@ alias ll='ls -lh' # Lists human readable sizes. alias lr='ll -R' # Lists human readable sizes, recursively. alias la='ll -A' # Lists human readable sizes, hidden files. alias lm='la | "$PAGER"' # Lists human readable sizes, hidden files through pager. -alias lx='ll -XB' # Lists sorted by extension (GNU only). alias lk='ll -Sr' # Lists sorted by size, largest last. 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. alias sl='ls' # I often screw this up. +# Only make alias if ls supports -XB (darwins BSD style ls doesn't) +if ls -XB &> /dev/null; then + alias lx='ll -XB' # Lists sorted by extension (GNU only). +fi + # Grep if zstyle -t ':prezto:module:utility:grep' color; then export GREP_COLOR='37;45' # BSD.