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
|
||||||
|
if [[ -v OSTYPE ]]; then
|
||||||
|
if [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
alias ls='ls --color=auto --human-readable --group-directories-first'
|
alias ls='ls --color=auto --human-readable --group-directories-first'
|
||||||
alias l='ls --classify -l'
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
alias la='ls --classify -la'
|
# check for coreutils presence, otherwise we're using bsd ls
|
||||||
alias lr='ls --classify -tR'
|
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