Fix main.zsh: Update critical z4h references to foxshell
This commit is contained in:
parent
7895365af9
commit
66c95890d9
1 changed files with 74 additions and 74 deletions
148
main.zsh
148
main.zsh
|
@ -1,9 +1,9 @@
|
||||||
if '[' '-z' "${ZSH_VERSION-}" ']' || ! 'eval' '[[ "$ZSH_VERSION" == (5.<8->*|<6->.*) ]]'; then
|
if '[' '-z' "${ZSH_VERSION-}" ']' || ! 'eval' '[[ "$ZSH_VERSION" == (5.<8->*|<6->.*) ]]'; then
|
||||||
'.' "$Z4H"/zsh4humans/sc/exec-zsh-i || 'return'
|
'.' "$FOXSHELL"/foxshell/sc/exec-zsh-i || 'return'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -x /proc/self/exe ]]; then
|
if [[ -x /proc/self/exe ]]; then
|
||||||
typeset -gr _z4h_exe=${${:-/proc/self/exe}:A}
|
typeset -gr _foxshell_exe=${${:-/proc/self/exe}:A}
|
||||||
else
|
else
|
||||||
() {
|
() {
|
||||||
emulate zsh -o posix_argzero -c 'local exe=${0#-}'
|
emulate zsh -o posix_argzero -c 'local exe=${0#-}'
|
||||||
|
@ -14,26 +14,26 @@ else
|
||||||
elif [[ -x $exe ]]; then
|
elif [[ -x $exe ]]; then
|
||||||
exe=${exe:a}
|
exe=${exe:a}
|
||||||
else
|
else
|
||||||
print -Pru2 -- "%F{3}z4h%f: unable to find path to %F{1}zsh%f"
|
print -Pru2 -- "%F{3}foxshell%f: unable to find path to %F{1}zsh%f"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
typeset -gr _z4h_exe=${exe:A}
|
typeset -gr _foxshell_exe=${exe:A}
|
||||||
} || return
|
} || return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! { zmodload -s zsh/terminfo zsh/zselect && [[ -n $^fpath/compinit(#qN) ]] ||
|
if ! { zmodload -s zsh/terminfo zsh/zselect && [[ -n $^fpath/compinit(#qN) ]] ||
|
||||||
[[ $ZSH_PATCHLEVEL == zsh-5.8-0-g77d203f && $_z4h_exe == */bin/zsh &&
|
[[ $ZSH_PATCHLEVEL == zsh-5.8-0-g77d203f && $_foxshell_exe == */bin/zsh &&
|
||||||
-e ${_z4h_exe:h:h}/share/zsh/5.8/scripts/relocate ]] }; then
|
-e ${_foxshell_exe:h:h}/share/zsh/5.8/scripts/relocate ]] }; then
|
||||||
builtin source $Z4H/zsh4humans/sc/exec-zsh-i || return
|
builtin source $FOXSHELL/foxshell/sc/exec-zsh-i || return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -o interactive ]]; then
|
if [[ ! -o interactive ]]; then
|
||||||
# print -Pru2 -- "%F{3}z4h%f: starting interactive %F{2}zsh%f"
|
# print -Pru2 -- "%F{3}foxshell%f: starting interactive %F{2}zsh%f"
|
||||||
# This is caused by Z4H_BOOTSTRAPPING, so we don't need to consult ZSH_SCRIPT and the like.
|
# This is caused by FOXSHELL_BOOTSTRAPPING, so we don't need to consult ZSH_SCRIPT and the like.
|
||||||
exec -- $_z4h_exe -i || return
|
exec -- $_foxshell_exe -i || return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
typeset -gr _z4h_opt='emulate -L zsh &&
|
typeset -gr _foxshell_opt='emulate -L zsh &&
|
||||||
setopt typeset_silent pipe_fail extended_glob prompt_percent no_prompt_subst &&
|
setopt typeset_silent pipe_fail extended_glob prompt_percent no_prompt_subst &&
|
||||||
setopt no_prompt_bang no_bg_nice no_aliases'
|
setopt no_prompt_bang no_bg_nice no_aliases'
|
||||||
|
|
||||||
|
@ -42,21 +42,21 @@ zmodload -F zsh/files b:{zf_mkdir,zf_mv,zf_rm,zf_rmdir,zf_ln} || return
|
||||||
zmodload -F zsh/stat b:zstat || return
|
zmodload -F zsh/stat b:zstat || return
|
||||||
|
|
||||||
() {
|
() {
|
||||||
if [[ $1 != $Z4H/zsh4humans/main.zsh ]]; then
|
if [[ $1 != $FOXSHELL/foxshell/main.zsh ]]; then
|
||||||
print -Pru2 -- "%F{3}z4h%f: confusing %Umain.zsh%u location: %F{1}${1//\%/%%}%f"
|
print -Pru2 -- "%F{3}foxshell%f: confusing %Umain.zsh%u location: %F{1}${1//\%/%%}%f"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if (( _z4h_zle )); then
|
if (( _foxshell_zle )); then
|
||||||
typeset -gr _z4h_param_pat=$'ZDOTDIR=$ZDOTDIR\0Z4H=$Z4H\0Z4H_URL=$Z4H_URL'
|
typeset -gr _foxshell_param_pat=$'ZDOTDIR=$ZDOTDIR\0FOXSHELL=$FOXSHELL\0FOXSHELL_URL=$FOXSHELL_URL'
|
||||||
typeset -gr _z4h_param_sig=${(e)_z4h_param_pat}
|
typeset -gr _foxshell_param_sig=${(e)_foxshell_param_pat}
|
||||||
function -z4h-check-core-params() {
|
function -foxshell-check-core-params() {
|
||||||
[[ "${(e)_z4h_param_pat}" == "$_z4h_param_sig" ]] || {
|
[[ "${(e)_foxshell_param_pat}" == "$_foxshell_param_sig" ]] || {
|
||||||
-z4h-error-param-changed
|
-foxshell-error-param-changed
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
function -z4h-check-core-params() {}
|
function -foxshell-check-core-params() {}
|
||||||
fi
|
fi
|
||||||
} ${${(%):-%x}:a} || return
|
} ${${(%):-%x}:a} || return
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export -T MANPATH=${MANPATH:-:} manpath
|
||||||
export -T INFOPATH=${INFOPATH:-:} infopath
|
export -T INFOPATH=${INFOPATH:-:} infopath
|
||||||
typeset -gaU cdpath fpath mailpath path manpath infopath
|
typeset -gaU cdpath fpath mailpath path manpath infopath
|
||||||
|
|
||||||
function -z4h-init-homebrew() {
|
function -foxshell-init-homebrew() {
|
||||||
(( ARGC )) || return 0
|
(( ARGC )) || return 0
|
||||||
local dir=${1:h:h}
|
local dir=${1:h:h}
|
||||||
export HOMEBREW_PREFIX=$dir
|
export HOMEBREW_PREFIX=$dir
|
||||||
|
@ -77,13 +77,13 @@ function -z4h-init-homebrew() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $OSTYPE == darwin* ]]; then
|
if [[ $OSTYPE == darwin* ]]; then
|
||||||
if [[ ! -e $Z4H/cache/init-darwin-paths ]] || ! source $Z4H/cache/init-darwin-paths; then
|
if [[ ! -e $FOXSHELL/cache/init-darwin-paths ]] || ! source $FOXSHELL/cache/init-darwin-paths; then
|
||||||
autoload -Uz $Z4H/zsh4humans/fn/-z4h-gen-init-darwin-paths
|
autoload -Uz $FOXSHELL/foxshell/fn/-foxshell-gen-init-darwin-paths
|
||||||
-z4h-gen-init-darwin-paths && source $Z4H/cache/init-darwin-paths
|
-foxshell-gen-init-darwin-paths && source $FOXSHELL/cache/init-darwin-paths
|
||||||
fi
|
fi
|
||||||
[[ -z $HOMEBREW_PREFIX ]] && -z4h-init-homebrew {/opt/homebrew,/usr/local}/bin/brew(N)
|
[[ -z $HOMEBREW_PREFIX ]] && -foxshell-init-homebrew {/opt/homebrew,/usr/local}/bin/brew(N)
|
||||||
elif [[ $OSTYPE == linux* && -z $HOMEBREW_PREFIX ]]; then
|
elif [[ $OSTYPE == linux* && -z $HOMEBREW_PREFIX ]]; then
|
||||||
-z4h-init-homebrew {/home/linuxbrew/.linuxbrew,~/.linuxbrew}/bin/brew(N)
|
-foxshell-init-homebrew {/home/linuxbrew/.linuxbrew,~/.linuxbrew}/bin/brew(N)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fpath=(
|
fpath=(
|
||||||
|
@ -92,10 +92,10 @@ fpath=(
|
||||||
/opt/homebrew/share/zsh/site-functions(-/N)
|
/opt/homebrew/share/zsh/site-functions(-/N)
|
||||||
/usr{/local,}/share/zsh/{site-functions,vendor-completions}(-/N)
|
/usr{/local,}/share/zsh/{site-functions,vendor-completions}(-/N)
|
||||||
$fpath
|
$fpath
|
||||||
$Z4H/zsh4humans/fn)
|
$FOXSHELL/foxshell/fn)
|
||||||
|
|
||||||
autoload -Uz -- $Z4H/zsh4humans/fn/(|-|_)z4h[^.]#(:t) || return
|
autoload -Uz -- $FOXSHELL/foxshell/fn/(|-|_)foxshell[^.]#(:t) || return
|
||||||
functions -Ms _z4h_err
|
functions -Ms _foxshell_err
|
||||||
|
|
||||||
() {
|
() {
|
||||||
path=(${@:|path} $path /snap/bin(-/N))
|
path=(${@:|path} $path /snap/bin(-/N))
|
||||||
|
@ -109,64 +109,64 @@ functions -Ms _z4h_err
|
||||||
infopath=(${@:|infopath} $infopath '')
|
infopath=(${@:|infopath} $infopath '')
|
||||||
} {${HOMEBREW_PREFIX:+$HOMEBREW_PREFIX/share/info},/opt/local/share/info}(-/N)
|
} {${HOMEBREW_PREFIX:+$HOMEBREW_PREFIX/share/info},/opt/local/share/info}(-/N)
|
||||||
|
|
||||||
if [[ $ZSH_PATCHLEVEL == zsh-5.8-0-g77d203f && $_z4h_exe == */bin/zsh &&
|
if [[ $ZSH_PATCHLEVEL == zsh-5.8-0-g77d203f && $_foxshell_exe == */bin/zsh &&
|
||||||
-e ${_z4h_exe:h:h}/share/zsh/5.8/scripts/relocate ]]; then
|
-e ${_foxshell_exe:h:h}/share/zsh/5.8/scripts/relocate ]]; then
|
||||||
if [[ $TERMINFO != ~/.terminfo && $TERMINFO != ${_z4h_exe:h:h}/share/terminfo &&
|
if [[ $TERMINFO != ~/.terminfo && $TERMINFO != ${_foxshell_exe:h:h}/share/terminfo &&
|
||||||
-e ${_z4h_exe:h:h}/share/terminfo/$TERM[1]/$TERM ]]; then
|
-e ${_foxshell_exe:h:h}/share/terminfo/$TERM[1]/$TERM ]]; then
|
||||||
export TERMINFO=${_z4h_exe:h:h}/share/terminfo
|
export TERMINFO=${_foxshell_exe:h:h}/share/terminfo
|
||||||
fi
|
fi
|
||||||
if [[ -e ${_z4h_exe:h:h}/share/man ]]; then
|
if [[ -e ${_foxshell_exe:h:h}/share/man ]]; then
|
||||||
manpath=(${_z4h_exe:h:h}/share/man $manpath '')
|
manpath=(${_foxshell_exe:h:h}/share/man $manpath '')
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
path+=($Z4H/fzf/bin)
|
path+=($FOXSHELL/fzf/bin)
|
||||||
manpath+=($Z4H/fzf/man)
|
manpath+=($FOXSHELL/fzf/man)
|
||||||
|
|
||||||
: ${GITSTATUS_CACHE_DIR=$Z4H/cache/gitstatus}
|
: ${GITSTATUS_CACHE_DIR=$FOXSHELL/cache/gitstatus}
|
||||||
: ${ZSH=$Z4H/ohmyzsh/ohmyzsh}
|
: ${ZSH=$FOXSHELL/ohmyzsh/ohmyzsh}
|
||||||
: ${ZSH_CUSTOM=$Z4H/ohmyzsh/ohmyzsh/custom}
|
: ${ZSH_CUSTOM=$FOXSHELL/ohmyzsh/ohmyzsh/custom}
|
||||||
: ${ZSH_CACHE_DIR=$Z4H/cache/ohmyzsh}
|
: ${ZSH_CACHE_DIR=$FOXSHELL/cache/ohmyzsh}
|
||||||
|
|
||||||
[[ $terminfo[Tc] == yes && -z $COLORTERM ]] && export COLORTERM=truecolor
|
[[ $terminfo[Tc] == yes && -z $COLORTERM ]] && export COLORTERM=truecolor
|
||||||
|
|
||||||
if [[ $EUID == 0 && -z ~(#qNU) && $Z4H == ~/* ]]; then
|
if [[ $EUID == 0 && -z ~(#qNU) && $FOXSHELL == ~/* ]]; then
|
||||||
typeset -gri _z4h_dangerous_root=1
|
typeset -gri _foxshell_dangerous_root=1
|
||||||
else
|
else
|
||||||
typeset -gri _z4h_dangerous_root=0
|
typeset -gri _foxshell_dangerous_root=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $langinfo[CODESET] == (utf|UTF)(-|)8 ]] || -z4h-fix-locale
|
[[ $langinfo[CODESET] == (utf|UTF)(-|)8 ]] || -foxshell-fix-locale
|
||||||
|
|
||||||
function -z4h-cmd-source() {
|
function -foxshell-cmd-source() {
|
||||||
local _z4h_file _z4h_compile
|
local _foxshell_file _foxshell_compile
|
||||||
zparseopts -D -F -- c=_z4h_compile -compile=_z4h_compile || return '_z4h_err()'
|
zparseopts -D -F -- c=_foxshell_compile -compile=_foxshell_compile || return '_foxshell_err()'
|
||||||
emulate zsh -o extended_glob -c 'local _z4h_files=(${^${(M)@:#/*}}(N) $Z4H/${^${@:#/*}}(N))'
|
emulate zsh -o extended_glob -c 'local _foxshell_files=(${^${(M)@:#/*}}(N) $FOXSHELL/${^${@:#/*}}(N))'
|
||||||
if (( ${#_z4h_compile} )); then
|
if (( ${#_foxshell_compile} )); then
|
||||||
builtin set --
|
builtin set --
|
||||||
for _z4h_file in "${_z4h_files[@]}"; do
|
for _foxshell_file in "${_foxshell_files[@]}"; do
|
||||||
-z4h-compile "$_z4h_file" || true
|
-foxshell-compile "$_foxshell_file" || true
|
||||||
builtin source -- "$_z4h_file"
|
builtin source -- "$_foxshell_file"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
emulate zsh -o extended_glob -c 'local _z4h_rm=(${^${(@)_z4h_files:#$Z4H/*}}.zwc(N))'
|
emulate zsh -o extended_glob -c 'local _foxshell_rm=(${^${(@)_foxshell_files:#$FOXSHELL/*}}.zwc(N))'
|
||||||
(( ! ${#_z4h_rm} )) || zf_rm -f -- "${_z4h_rm[@]}" || true
|
(( ! ${#_foxshell_rm} )) || zf_rm -f -- "${_foxshell_rm[@]}" || true
|
||||||
builtin set --
|
builtin set --
|
||||||
for _z4h_file in "${_z4h_files[@]}"; do
|
for _foxshell_file in "${_foxshell_files[@]}"; do
|
||||||
builtin source -- "$_z4h_file"
|
builtin source -- "$_foxshell_file"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function -z4h-cmd-load() {
|
function -foxshell-cmd-load() {
|
||||||
local -a compile
|
local -a compile
|
||||||
zparseopts -D -F -- c=compile -compile=compile || return '_z4h_err()'
|
zparseopts -D -F -- c=compile -compile=compile || return '_foxshell_err()'
|
||||||
|
|
||||||
local -a files
|
local -a files
|
||||||
|
|
||||||
() {
|
() {
|
||||||
emulate -L zsh -o extended_glob
|
emulate -L zsh -o extended_glob
|
||||||
local pkgs=(${(M)@:#/*} $Z4H/${^${@:#/*}})
|
local pkgs=(${(M)@:#/*} $FOXSHELL/${^${@:#/*}})
|
||||||
pkgs=(${^${(u)pkgs}}(-/FN))
|
pkgs=(${^${(u)pkgs}}(-/FN))
|
||||||
local dirs=(${^pkgs}/functions(-/FN))
|
local dirs=(${^pkgs}/functions(-/FN))
|
||||||
local funcs=(${^dirs}/^([_.]*|prompt_*_setup|README*|*~|*.zwc)(-.N:t))
|
local funcs=(${^dirs}/^([_.]*|prompt_*_setup|README*|*~|*.zwc)(-.N:t))
|
||||||
|
@ -182,28 +182,28 @@ function -z4h-cmd-load() {
|
||||||
done
|
done
|
||||||
} "$@"
|
} "$@"
|
||||||
|
|
||||||
-z4h-cmd-source "${compile[@]}" -- "${files[@]}"
|
-foxshell-cmd-source "${compile[@]}" -- "${files[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function -z4h-cmd-init() {
|
function -foxshell-cmd-init() {
|
||||||
if (( ARGC )); then
|
if (( ARGC )); then
|
||||||
print -ru2 -- ${(%):-"%F{3}z4h%f: unexpected %F{1}init%f argument"}
|
print -ru2 -- ${(%):-"%F{3}foxshell%f: unexpected %F{1}init%f argument"}
|
||||||
return '_z4h_err()'
|
return '_foxshell_err()'
|
||||||
fi
|
fi
|
||||||
if (( ${+_z4h_init_called} )); then
|
if (( ${+_foxshell_init_called} )); then
|
||||||
if [[ ${funcfiletrace[-1]} != zsh:0 ]]; then
|
if [[ ${funcfiletrace[-1]} != zsh:0 ]]; then
|
||||||
if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
|
if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
|
||||||
>&2 'printf' '\033[33mz4h\033[0m: please use \033[4;32mexec\033[0m \033[32mzsh\033[0m instead of \033[32msource\033[0m \033[4m~/.zshrc\033[0m\n'
|
>&2 'printf' '\033[33mfoxshell\033[0m: please use \033[4;32mexec\033[0m \033[32mzsh\033[0m instead of \033[32msource\033[0m \033[4m~/.zshrc\033[0m\n'
|
||||||
else
|
else
|
||||||
>&2 'printf' '\033[33mz4h\033[0m: please use \033[4;32mexec\033[0m \033[32mzsh\033[0m instead of \033[32msource\033[0m \033[4;33m"$ZDOTDIR"\033[0;4m/.zshrc\033[0m\n'
|
>&2 'printf' '\033[33mfoxshell\033[0m: please use \033[4;32mexec\033[0m \033[32mzsh\033[0m instead of \033[32msource\033[0m \033[4;33m"$ZDOTDIR"\033[0;4m/.zshrc\033[0m\n'
|
||||||
fi
|
fi
|
||||||
'return' '1'
|
'return' '1'
|
||||||
fi
|
fi
|
||||||
print -ru2 -- ${(%):-"%F{3}z4h%f: %F{1}init%f cannot be called more than once"}
|
print -ru2 -- ${(%):-"%F{3}foxshell%f: %F{1}init%f cannot be called more than once"}
|
||||||
return '_z4h_err()'
|
return '_foxshell_err()'
|
||||||
fi
|
fi
|
||||||
-z4h-check-core-params || return
|
-foxshell-check-core-params || return
|
||||||
typeset -gri _z4h_init_called=1
|
typeset -gri _foxshell_init_called=1
|
||||||
|
|
||||||
() {
|
() {
|
||||||
eval "$_z4h_opt"
|
eval "$_z4h_opt"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue