refactor: colourise ls based on operating system
Use different method for coloured ls on macOS & Linux.
This commit is contained in:
parent
63dc963b00
commit
a3f9c9f462
1 changed files with 15 additions and 4 deletions
|
@ -11,10 +11,21 @@ alias cp='cp -i'
|
||||||
alias mv='mv -i'
|
alias mv='mv -i'
|
||||||
|
|
||||||
# ls
|
# ls
|
||||||
alias ls='ls --color=auto --human-readable --group-directories-first'
|
if [[ -v OSTYPE ]]; then
|
||||||
alias l='ls --classify -l'
|
if [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
alias la='ls --classify -la'
|
alias ls='ls --color=auto --human-readable --group-directories-first'
|
||||||
alias lr='ls --classify -tR'
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# check for coreutils presence, otherwise we're using bsd ls
|
||||||
|
if command -v gls &> /dev/null; then
|
||||||
|
alias ls='gls --color=auto --human-readable --group-directories-first'
|
||||||
|
else
|
||||||
|
alias ls='ls -G'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
alias l='ls -l'
|
||||||
|
alias la='ls -la'
|
||||||
|
alias lr='ls -lR'
|
||||||
|
|
||||||
# directories
|
# directories
|
||||||
setopt AUTO_CD # prefix command with 'cd' if it cannot be executed, e.g. '..' becomes 'cd ..'
|
setopt AUTO_CD # prefix command with 'cd' if it cannot be executed, e.g. '..' becomes 'cd ..'
|
||||||
|
|
Loading…
Reference in a new issue