From 2d43ef9a1e04c3883561dffa80639d076a580644 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 23 Sep 2024 14:44:26 -0700 Subject: [PATCH] [zsh] Replace implementation of init_path with update-path call Rename this function with hyphens instead of underscores. --- zsh/func/init-path | 26 +++++++++++++++++++++++++ zsh/func/init_path | 47 ---------------------------------------------- zshenv | 2 +- 3 files changed, 27 insertions(+), 48 deletions(-) create mode 100644 zsh/func/init-path delete mode 100644 zsh/func/init_path diff --git a/zsh/func/init-path b/zsh/func/init-path new file mode 100644 index 0000000..7357762 --- /dev/null +++ b/zsh/func/init-path @@ -0,0 +1,26 @@ +# Eryn Wells + +autoload -Uz update-path + +function init-path +{ + update-path \ + "$HOME/bin" \ + "$HOME/.local/bin" \ + "$HOME/.cargo/bin" \ + "$HOME/.ghcup/bin" \ + "$HOME/.gem/ruby/2.2.0/bin" \ + "$HOME/.vim/bundle/vim-tidal/bin" \ + /opt/local/bin \ + /usr/X11/bin \ + /opt/brew/bin \ + /opt/homebrew/bin \ + /usr/local/bin \ + /usr/bin \ + /bin \ + /usr/local/sbin \ + /usr/sbin \ + /sbin +} + +init-path "$@" diff --git a/zsh/func/init_path b/zsh/func/init_path deleted file mode 100644 index 64e9227..0000000 --- a/zsh/func/init_path +++ /dev/null @@ -1,47 +0,0 @@ -# Eryn Wells - -autoload -Uz append_to_path - -init_path() { - local should_be_verbose=0 - - while getopts "v" opt; do - case $opt in - "v") should_be_verbose=1;; - "+v") should_be_verbose=0;; - *) ;; - esac - done - - local verbose_flag='' - if (( $should_be_verbose )); then - verbose_flag='-v' - fi - - for p in \ - "$HOME/bin" \ - "$HOME/.local/bin" \ - "$HOME/.cargo/bin" \ - "$HOME/.ghcup/bin" \ - "$HOME/.gem/ruby/2.2.0/bin" \ - "$HOME/.vim/bundle/vim-tidal/bin" \ - "/opt/local/bin" \ - "/usr/X11/bin" \ - "/opt/brew/bin" \ - "/opt/homebrew/bin" \ - "/usr/local/bin" \ - "/usr/bin" \ - "/bin" \ - "/usr/local/sbin" \ - "/usr/sbin" \ - "/sbin" - do - append_to_path +e $verbose_flag "$p" - done - - export path - - rehash -} - -init_path "$@" diff --git a/zshenv b/zshenv index 572807d..b35889a 100644 --- a/zshenv +++ b/zshenv @@ -21,7 +21,7 @@ init_env_fpath autoload -Uz do_init_functions typeset -a zsh_init_env_functions=( \ - init_path \ + init-path \ init_system_parameters \ init_env \ init_env_aliases \