From ed13222d7f61e0dc29b369aa631fce01752830ef Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sat, 22 Jan 2022 10:12:03 -0800 Subject: [PATCH] [zsh] Move init_rc_configure_ls to init_configure_ls --- zsh/func/init_configure_ls | 33 ++++++++++++++++++++++++++++++ zsh/func/init_rc_configure_ls | 38 ----------------------------------- zshrc | 20 +++++++++--------- 3 files changed, 43 insertions(+), 48 deletions(-) create mode 100644 zsh/func/init_configure_ls delete mode 100644 zsh/func/init_rc_configure_ls diff --git a/zsh/func/init_configure_ls b/zsh/func/init_configure_ls new file mode 100644 index 0000000..088b5f4 --- /dev/null +++ b/zsh/func/init_configure_ls @@ -0,0 +1,33 @@ +#!/usr/bin/env zsh +# Eryn Wells + +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 diff --git a/zsh/func/init_rc_configure_ls b/zsh/func/init_rc_configure_ls deleted file mode 100644 index d560669..0000000 --- a/zsh/func/init_rc_configure_ls +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env zsh -# Eryn Wells - -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 "$@" diff --git a/zshrc b/zshrc index 600d0af..9334aa7 100644 --- a/zshrc +++ b/zshrc @@ -1,15 +1,15 @@ #!/usr/bin/env zsh # Eryn Wells -autoload +X init_app_environments -autoload +X init_rc_aliases -autoload +X init_rc_configure_completion -autoload +X init_rc_configure_ls -autoload +X init_rc_configure_prompt -autoload +X init_rc_configure_zle -autoload +X init_zsh_options -autoload +X init_zsh_history -autoload +X init_zsh_functions +autoload -Uz init_app_environments +autoload -Uz init_configure_ls +autoload -Uz init_rc_aliases +autoload -Uz init_rc_configure_completion +autoload -Uz init_rc_configure_prompt +autoload -Uz init_rc_configure_zle +autoload -Uz init_zsh_options +autoload -Uz init_zsh_history +autoload -Uz init_zsh_functions init_rc_aliases init_rc_configure_prompt loquacious @@ -25,7 +25,7 @@ init_rc_$SYS # Configure ls with the system ls if it hasn't been done already. if ! alias ls 2>&1 1>/dev/null; then - init_rc_configure_ls `which ls` + init_configure_ls `which ls` fi autoload g