From 897afc9cf9045922922f962176fc48949b6c85e8 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Mon, 17 Jun 2024 07:22:18 -0500 Subject: [PATCH] Reapply "Use `${HOME}` in generated static init.zsh script" This reverts commit 9a47fde0c8bda7f401befc45d430e2dc06d337be. --- src/functions/30_zmodule.zsh.erb | 9 +++++---- src/stage2/29_zimfw_build_init.zsh.erb | 4 ++-- zimfw.zsh | 15 ++++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/functions/30_zmodule.zsh.erb b/src/functions/30_zmodule.zsh.erb index 66734f1..858d1aa 100644 --- a/src/functions/30_zmodule.zsh.erb +++ b/src/functions/30_zmodule.zsh.erb @@ -189,11 +189,11 @@ Per-call initialization options: shift zarg=${1} if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg} - zcmds+=("source ${(q-)zarg:a}") + zcmds+=('source '${(qqq)zarg:a}) ;; -c|--cmd) shift - zcmds+=(${1//{}/${(q-)zroot_dir:a}}) + zcmds+=(${1//{}/${(qqq)zroot_dir:a}}) ;; -d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;; *) @@ -221,11 +221,11 @@ Per-call initialization options: local -ra prezto_scripts=(${zroot_dir}/init.zsh(N)) if (( ${#zfpaths} && ${#prezto_scripts} )); then # this follows the prezto module format, no need to check for other scripts - zcmds=('source '${(q-)^prezto_scripts:a}) + zcmds=('source '${(qqq)^prezto_scripts:a}) else # get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first) local -ra zscripts=(${zroot_dir}/(init.zsh|(${zname:t}|${zroot_dir:t}).(zsh|plugin.zsh|zsh-theme|sh))(NOL[1])) - zcmds=('source '${(q-)^zscripts:a}) + zcmds=('source '${(qqq)^zscripts:a}) fi fi if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then @@ -235,6 +235,7 @@ Per-call initialization options: local -r zpre=${zroot_dir}$'\0' _zfpaths+=(${zpre}${^zfpaths}) _zfunctions+=(${zpre}${^zfunctions}) + zcmds=(${zcmds//${HOME}/\${HOME}}) _zcmds+=(${zpre}${^zcmds}) fi } diff --git a/src/stage2/29_zimfw_build_init.zsh.erb b/src/stage2/29_zimfw_build_init.zsh.erb index db58bfd..1f80a24 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 "zimfw() { source ${(q-)__ZIMFW_PATH}/zimfw.zsh \"\${@}\" }" + print -R 'zimfw() { source '${${(qqq)__ZIMFW_PATH}/${HOME}/\${HOME}}'/zimfw.zsh "${@}" }' local zroot_dir zpre local -a zif_functions zif_cmds zroot_functions zroot_cmds local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds}) @@ -21,7 +21,7 @@ _zimfw_build_init() { fi done zpre=$'*\0' - if (( ${#_zfpaths} )) print -R 'fpath=('${(q-)${_zfpaths#${~zpre}}:a}' ${fpath})' + if (( ${#_zfpaths} )) print -R 'fpath=('${${(qqq)${_zfpaths#${~zpre}}:a}/${HOME}/\${HOME}}' ${fpath})' if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}} for zroot_dir in ${_zroot_dirs}; do zpre=${zroot_dir}$'\0' diff --git a/zimfw.zsh b/zimfw.zsh index eb73da8..a6aec57 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 "zimfw() { source ${(q-)__ZIMFW_PATH}/zimfw.zsh \"\${@}\" }" + print -R 'zimfw() { source '${${(qqq)__ZIMFW_PATH}/${HOME}/\${HOME}}'/zimfw.zsh "${@}" }' local zroot_dir zpre local -a zif_functions zif_cmds zroot_functions zroot_cmds local -a zfunctions=(${_zfunctions}) zcmds=(${_zcmds}) @@ -77,7 +77,7 @@ _zimfw_build_init() { fi done zpre=$'*\0' - if (( ${#_zfpaths} )) print -R 'fpath=('${(q-)${_zfpaths#${~zpre}}:a}' ${fpath})' + if (( ${#_zfpaths} )) print -R 'fpath=('${${(qqq)${_zfpaths#${~zpre}}:a}/${HOME}/\${HOME}}' ${fpath})' if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}} for zroot_dir in ${_zroot_dirs}; do zpre=${zroot_dir}$'\0' @@ -305,11 +305,11 @@ Per-call initialization options: shift zarg=${1} if [[ ${zarg} != /* ]] zarg=${zroot_dir}/${zarg} - zcmds+=("source ${(q-)zarg:a}") + zcmds+=('source '${(qqq)zarg:a}) ;; -c|--cmd) shift - zcmds+=(${1//{}/${(q-)zroot_dir:a}}) + zcmds+=(${1//{}/${(qqq)zroot_dir:a}}) ;; -d|--disabled) _zdisabled_root_dirs+=(${zroot_dir}) ;; *) @@ -337,11 +337,11 @@ Per-call initialization options: local -ra prezto_scripts=(${zroot_dir}/init.zsh(N)) if (( ${#zfpaths} && ${#prezto_scripts} )); then # this follows the prezto module format, no need to check for other scripts - zcmds=('source '${(q-)^prezto_scripts:a}) + zcmds=('source '${(qqq)^prezto_scripts:a}) else # get script with largest size (descending `O`rder by `L`ength, and return only `[1]` first) local -ra zscripts=(${zroot_dir}/(init.zsh|(${zname:t}|${zroot_dir:t}).(zsh|plugin.zsh|zsh-theme|sh))(NOL[1])) - zcmds=('source '${(q-)^zscripts:a}) + zcmds=('source '${(qqq)^zscripts:a}) fi fi if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zcmds} )); then @@ -351,6 +351,7 @@ Per-call initialization options: local -r zpre=${zroot_dir}$'\0' _zfpaths+=(${zpre}${^zfpaths}) _zfunctions+=(${zpre}${^zfunctions}) + zcmds=(${zcmds//${HOME}/\${HOME}}) _zcmds+=(${zpre}${^zcmds}) fi } @@ -461,7 +462,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2024-06-15 01:16:55 UTC, previous commit is 9a47fde)' + print -R 'zimfw version: '${_zversion}' (built at 2024-06-17 12:21:22 UTC, previous commit is 76164d6)' 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}