[zsh] Update shell init: rc
This commit is contained in:
parent
b09d523218
commit
c30b46a88b
26 changed files with 479 additions and 462 deletions
41
zsh/func/init_rc_configure_ls
Normal file
41
zsh/func/init_rc_configure_ls
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
function init_configure_ls
|
||||
{
|
||||
local has_gnu_ls
|
||||
local ls_options
|
||||
|
||||
if [[ ! -e "$1" ]]; then
|
||||
shell-log -l error 'Missing required path to ls binary'
|
||||
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
|
||||
|
||||
shell-log -l debug "Setting up aliases for $1"
|
||||
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
|
||||
|
||||
shell-log -l debug "Setting up dircolors: `basename $dircolors`"
|
||||
eval `$dircolors_bin $dircolors`
|
||||
fi
|
||||
}
|
||||
|
||||
init_configure_ls "$@"
|
Loading…
Add table
Add a link
Reference in a new issue