diff --git a/src/stage2/29_zimfw_build_init.zsh.erb b/src/stage2/29_zimfw_build_init.zsh.erb index 1e64abd..9822237 100644 --- a/src/stage2/29_zimfw_build_init.zsh.erb +++ b/src/stage2/29_zimfw_build_init.zsh.erb @@ -1,7 +1,7 @@ _zimfw_build_init() { local -r ztarget=${ZIM_HOME}/init.zsh # Force update of init.zsh if it's older than .zimrc - if [[ ${ztarget} -ot <%= home %>/.zimrc ]]; then + if [[ ${ztarget} -ot ${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} ]]; then command mv -f ${ztarget}{,.old} || return 1 fi _zimfw_mv =( diff --git a/src/stage2/29_zimfw_build_login_init.zsh.erb b/src/stage2/29_zimfw_build_login_init.zsh.erb index 291fc40..98dc03a 100644 --- a/src/stage2/29_zimfw_build_login_init.zsh.erb +++ b/src/stage2/29_zimfw_build_login_init.zsh.erb @@ -1,7 +1,7 @@ _zimfw_build_login_init() { local -r ztarget=${ZIM_HOME}/login_init.zsh # Force update of login_init.zsh if it's older than .zimrc - if [[ ${ztarget} -ot <%= home %>/.zimrc ]]; then + if [[ ${ztarget} -ot ${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} ]]; then command mv -f ${ztarget}{,.old} || return 1 fi _zimfw_mv =( diff --git a/src/stage2/30_zmodule.zsh.erb b/src/stage2/30_zmodule.zsh.erb index afa8899..f549270 100644 --- a/src/stage2/30_zmodule.zsh.erb +++ b/src/stage2/30_zmodule.zsh.erb @@ -1,7 +1,8 @@ zmodule() { + local -r ztarget=${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} local -r zusage="Usage: %B${0}%b [%B-n%b|%B--name%b ] [%B-r%b|%B--root%b ] [options] -Add %Bzmodule%b calls to your %B${ZDOTDIR:-${HOME}}/.zimrc%b file to define the modules to be initialized. +Add %Bzmodule%b calls to your %B${ztarget}%b file to define the modules to be initialized. The initialization will be done in the same order it's defined. Module absolute path or repository URL. The following URL formats @@ -60,8 +61,8 @@ Per-call initialization options: other per-call initialization options, so only your provided values will be used. I.e. these values are either all automatic, or all manual in each zmodule call. To use default values and also provided values, use separate zmodule calls." - if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then - print -u2 -PlR "%F{red}${0}: Must be called from %B<%= home %>/.zimrc%b%f" '' ${zusage} + if [[ ${${funcfiletrace[1]%:*}:A} != ${ztarget:A} ]]; then + print -u2 -PlR "%F{red}${0}: Must be called from %B${ztarget}%b%f" '' ${zusage} return 2 fi if (( ! # )); then diff --git a/src/stage2/31_zimfw_source_zimrc.zsh.erb b/src/stage2/31_zimfw_source_zimrc.zsh.erb index c9c33b0..71b8e9f 100644 --- a/src/stage2/31_zimfw_source_zimrc.zsh.erb +++ b/src/stage2/31_zimfw_source_zimrc.zsh.erb @@ -1,5 +1,5 @@ _zimfw_source_zimrc() { - local -r ztarget=<%= home %>/.zimrc _zflags=${1} + local -r ztarget=${ZIM_CONFIG_FILE:-<%= home %>/.zimrc} _zflags=${1} local -i _zfailed=0 if ! source ${ztarget} || (( _zfailed )); then print -u2 -PR "%F{red}<%= failed %>Failed to source %B${ztarget}%b%f" diff --git a/src/stage2/80_zimfw.zsh.erb b/src/stage2/80_zimfw.zsh.erb index 9f4d4e0..896191f 100644 --- a/src/stage2/80_zimfw.zsh.erb +++ b/src/stage2/80_zimfw.zsh.erb @@ -12,7 +12,7 @@ Actions: %Bcompile%b Compile Zsh files. %Bhelp%b Print this help. %Binfo%b Print Zim and system info. - %Blist%b List all modules currently defined in %B<%= home %>/.zimrc%b. + %Blist%b List all modules currently defined in %B${ZIM_CONFIG_FILE:-<%= home %>/.zimrc}%b. Use %B-v%b to also see the modules details. %Binit%b Same as %Binstall%b, but with output tailored to be used at terminal startup. %Binstall%b Install new modules. Also does %Bbuild%b, %Bcheck-dumpfile%b and %Bcompile%b. Use %B-v%b to diff --git a/zimfw.zsh b/zimfw.zsh index 796c9e6..fda3f1a 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -53,7 +53,7 @@ _zimfw_mv() { _zimfw_build_init() { local -r ztarget=${ZIM_HOME}/init.zsh # Force update of init.zsh if it's older than .zimrc - if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then + if [[ ${ztarget} -ot ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then command mv -f ${ztarget}{,.old} || return 1 fi _zimfw_mv =( @@ -99,7 +99,7 @@ _zimfw_build_init() { _zimfw_build_login_init() { local -r ztarget=${ZIM_HOME}/login_init.zsh # Force update of login_init.zsh if it's older than .zimrc - if [[ ${ztarget} -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then + if [[ ${ztarget} -ot ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then command mv -f ${ztarget}{,.old} || return 1 fi _zimfw_mv =( @@ -113,9 +113,10 @@ _zimfw_build() { } zmodule() { + local -r ztarget=${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} local -r zusage="Usage: %B${0}%b [%B-n%b|%B--name%b ] [%B-r%b|%B--root%b ] [options] -Add %Bzmodule%b calls to your %B${ZDOTDIR:-${HOME}}/.zimrc%b file to define the modules to be initialized. +Add %Bzmodule%b calls to your %B${ztarget}%b file to define the modules to be initialized. The initialization will be done in the same order it's defined. Module absolute path or repository URL. The following URL formats @@ -174,8 +175,8 @@ Per-call initialization options: other per-call initialization options, so only your provided values will be used. I.e. these values are either all automatic, or all manual in each zmodule call. To use default values and also provided values, use separate zmodule calls." - if [[ ${${funcfiletrace[1]%:*}:t} != .zimrc ]]; then - print -u2 -PlR "%F{red}${0}: Must be called from %B${ZDOTDIR:-${HOME}}/.zimrc%b%f" '' ${zusage} + if [[ ${${funcfiletrace[1]%:*}:A} != ${ztarget:A} ]]; then + print -u2 -PlR "%F{red}${0}: Must be called from %B${ztarget}%b%f" '' ${zusage} return 2 fi if (( ! # )); then @@ -341,7 +342,7 @@ Per-call initialization options: } _zimfw_source_zimrc() { - local -r ztarget=${ZDOTDIR:-${HOME}}/.zimrc _zflags=${1} + local -r ztarget=${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} _zflags=${1} local -i _zfailed=0 if ! source ${ztarget} || (( _zfailed )); then print -u2 -PR "%F{red}Failed to source %B${ztarget}%b%f" @@ -454,7 +455,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2022-10-07 00:49:27 UTC, previous commit is 8a9d63c)' + print -R 'zimfw version: '${_zversion}' (built at 2022-10-24 00:21:20 UTC, previous commit is 3959a7f)' print -R 'OSTYPE: '${OSTYPE} print -R 'TERM: '${TERM} print -R 'TERM_PROGRAM: '${TERM_PROGRAM} @@ -853,7 +854,7 @@ Actions: %Bcompile%b Compile Zsh files. %Bhelp%b Print this help. %Binfo%b Print Zim and system info. - %Blist%b List all modules currently defined in %B${ZDOTDIR:-${HOME}}/.zimrc%b. + %Blist%b List all modules currently defined in %B${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc}%b. Use %B-v%b to also see the modules details. %Binit%b Same as %Binstall%b, but with output tailored to be used at terminal startup. %Binstall%b Install new modules. Also does %Bbuild%b, %Bcheck-dumpfile%b and %Bcompile%b. Use %B-v%b to