From e31301d0ff52563d00e8a193be4bc65047ba769f Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 9 Dec 2024 10:55:08 +0000 Subject: [PATCH] chore(zshrc): minor re-orders of a few sections --- zshrc | 68 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/zshrc b/zshrc index 987a4b4..685c265 100644 --- a/zshrc +++ b/zshrc @@ -9,6 +9,12 @@ if [[ "$OSTYPE" == "darwin"* ]] && [ -f "/etc/zshrc" ]; then source "/etc/zshrc" fi +# ============================================================================== +# Helper Functions +# ============================================================================== + +source "$DOTZSH/zshrc.funcs.zsh" + # ============================================================================== # Zinit # ============================================================================== @@ -36,6 +42,21 @@ source "${ZINIT[BIN_DIR]}/zinit.zsh" # from the system clipboard. zinit for @OMZ::lib/clipboard.zsh +# ============================================================================== +# Environment +# ============================================================================== + +# Ensure mise shims directory is in PATH so that installed tools are immediately +# available for use within shell initialization. We activate mise normally right +# at end which replaces the shims in PATH with a shell hook that updates PATH as +# needed. +path_prepend "$MISE_HOME/shims" + +# If available, make sure to load direnv shell hook before mise. +if command-exists direnv; then + cached-eval "$(command-path direnv)" direnv hook zsh +fi + # ============================================================================== # History # ============================================================================== @@ -203,29 +224,10 @@ autoload -z edit-command-line zle -N edit-command-line bindkey "^X^E" edit-command-line -# ============================================================================== -# Helper Functions -# ============================================================================== - -source "$DOTZSH/zshrc.funcs.zsh" - -# ============================================================================== -# Private Dotfiles -# ============================================================================== - -if [ -f "$DOTPFILES/zshrc" ]; then - source "$DOTPFILES/zshrc" -fi - # ============================================================================== # Environment and Tool Managers # ============================================================================== -# If available, make sure to load direnv shell hook before mise. -if command-exists direnv; then - cached-eval "$(command-path direnv)" direnv hook zsh -fi - MISE_HOME="$HOME/.local/share/mise" MISE_ZSH_INIT="$MISE_HOME/shell/init.zsh" export MISE_INSTALL_PATH="$MISE_HOME/bin/mise" @@ -237,12 +239,6 @@ fi if command-exists mise; then alias mi="mise" - - # Ensure shims directory is in PATH so that install tools are immediately - # available for use within shell initialization. We activate mise normally - # right at end which replaces the shims in PATH with a shell hook that updates - # PATH as needed. - path_prepend "$MISE_HOME/shims" setup-completions mise "$MISE_INSTALL_PATH" mise completions zsh fi @@ -263,6 +259,14 @@ else echo " install with: mise install starship" >&2 fi +# ============================================================================== +# Private Dotfiles +# ============================================================================== + +if [ -f "$DOTPFILES/zshrc" ]; then + source "$DOTPFILES/zshrc" +fi + # ============================================================================== # Tool specific setup # ============================================================================== @@ -312,6 +316,13 @@ unsetopt share_history # Disable attempted correction of commands (is wrong 98% of the time). unsetopt correctall +# ============================================================================== +# Prepare interactive environment +# ============================================================================== + +# Activate mise properly for interactive use not using shims. +eval "$("$MISE_INSTALL_PATH" activate zsh)" + # ============================================================================== # Local Overrides # ============================================================================== @@ -321,10 +332,3 @@ if [ -f "$HOME/.zshrc.local" ]; then fi autoload -U +X bashcompinit && bashcompinit - -# ============================================================================== -# Prepare interactive environment -# ============================================================================== - -# Activate mise properly for interactive use not using shims. -eval "$("$MISE_INSTALL_PATH" activate zsh)"