From 7f3491b1bbc9759d7df83af6ba08ddc63d1d44d2 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Fri, 16 Aug 2024 23:46:32 -0500 Subject: [PATCH] Don't autoload zimfw if no config file exists instead of if no ${ZIM_HOME} exists. If current user has no config file, then most likely they're sourcing the init.zsh generated by another user in the same machine. --- src/stage2/29_zimfw_build_init.zsh.erb | 2 +- zimfw.zsh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stage2/29_zimfw_build_init.zsh.erb b/src/stage2/29_zimfw_build_init.zsh.erb index 4b268b1..712d39f 100644 --- a/src/stage2/29_zimfw_build_init.zsh.erb +++ b/src/stage2/29_zimfw_build_init.zsh.erb @@ -5,7 +5,7 @@ _zimfw_build_init() { command mv -f ${ztarget}{,.old} || return 1 fi _zimfw_mv =( - print -R 'if (( ${+ZIM_HOME} )) zimfw() { source '${${(qqq)__ZIMFW_FILE}/${HOME}/\${HOME}}' "${@}" }' + print -R 'if [[ -e ${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} ]] zimfw() { source '${${(qqq)__ZIMFW_FILE}/${HOME}/\${HOME}}' "${@}" }' local zroot_dir zpre local -a zif_functions zif_cmds zroot_functions zroot_cmds local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds}) diff --git a/zimfw.zsh b/zimfw.zsh index 5cfd2fd..d9fa506 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -61,7 +61,7 @@ _zimfw_build_init() { command mv -f ${ztarget}{,.old} || return 1 fi _zimfw_mv =( - print -R 'if (( ${+ZIM_HOME} )) zimfw() { source '${${(qqq)__ZIMFW_FILE}/${HOME}/\${HOME}}' "${@}" }' + print -R 'if [[ -e ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]] zimfw() { source '${${(qqq)__ZIMFW_FILE}/${HOME}/\${HOME}}' "${@}" }' local zroot_dir zpre local -a zif_functions zif_cmds zroot_functions zroot_cmds local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds}) @@ -462,7 +462,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2024-06-25 17:29:35 UTC, previous commit is 3b7908d)' + print -R 'zimfw version: '${_zversion}' (built at 2024-06-25 18:20:18 UTC, previous commit is 6166fce)' local zparam for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do print -R ${(r.22....:.)zparam}${(P)zparam}