[zsh] Move init_rc_configure_ls to init_configure_ls

This commit is contained in:
Eryn Wells 2022-01-22 10:12:03 -08:00
parent 8eebcd73de
commit ed13222d7f
3 changed files with 43 additions and 48 deletions

View file

@ -0,0 +1,33 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
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

View file

@ -1,38 +0,0 @@
#!/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 "$@"