38 lines
867 B
Bash
38 lines
867 B
Bash
#!/usr/bin/env zsh
|
|
# Eryn Wells <eryn@erynwells.me>
|
|
|
|
function init_configure_ls
|
|
{
|
|
local has_gnu_ls
|
|
local ls_options
|
|
|
|
if [[ ! -e "$1" ]]; then
|
|
return
|
|
fi
|
|
|
|
if $1 --version 2>&1 | grep GNU 1>/dev/null; then
|
|
has_gnu_ls=1
|
|
ls_options='--color=auto'
|
|
else
|
|
has_gnu_ls=0
|
|
ls_options='-G'
|
|
fi
|
|
|
|
alias ls="$1 $ls_options"
|
|
alias la="$1 -A $ls_options"
|
|
alias ll="$1 -l $ls_options"
|
|
alias l.="$1 -d $ls_options .*"
|
|
|
|
local dircolors_bin=`whence -p dircolors || whence -p gdircolors`
|
|
if [[ $has_gnu_ls -eq 1 && -n "$dircolors_bin" ]]; then
|
|
if [[ -e "$HOME/.dircolors/$SYS.cfg" ]]; then
|
|
dircolors="$HOME/.dircolors/$SYS.cfg"
|
|
else
|
|
dircolors="$HOME/.dircolors/default.cfg"
|
|
fi
|
|
|
|
eval `$dircolors_bin $dircolors`
|
|
fi
|
|
}
|
|
|
|
init_configure_ls "$@"
|