ZSH+;OH-MY-ZSH启动时的奇数文本(cygwin)
在我的cygwin安装上运行zsh+oh my zsh。每当我启动一个新的ZSH会话(新的mintty、tmux等),它都会输出下面的文本。我不认为这会影响ZSH的性能,但它非常烦人ZSH+;OH-MY-ZSH启动时的奇数文本(cygwin),cygwin,zsh,oh-my-zsh,Cygwin,Zsh,Oh My Zsh,在我的cygwin安装上运行zsh+oh my zsh。每当我启动一个新的ZSH会话(新的mintty、tmux等),它都会输出下面的文本。我不认为这会影响ZSH的性能,但它非常烦人 add-zsh-hook () { emulate -L zsh local -a hooktypes hooktypes=(chpwd precmd preexec periodic zshaddhistory zshexit zsh_direc
add-zsh-hook () {
emulate -L zsh
local -a hooktypes
hooktypes=(chpwd precmd preexec periodic zshaddhistory zshexit zsh_direc tory_name)
local usage="Usage: $0 hook function\nValid hooks are:\n $hooktypes"
local opt
local -a autoopts
integer del list help
while getopts "dDhLUzk" opt
do
case $opt in
(d) del=1 ;;
(D) del=2 ;;
(h) help=1 ;;
(L) list=1 ;;
([Uzk]) autoopts+=(-$opt) ;;
(*) return 1 ;;
esac
done
shift $(( OPTIND - 1 ))
if (( list ))
then
typeset -mp "(${1:-${(@j:|:)hooktypes}})_functions"
return $?
elif (( help || $# != 2 || ${hooktypes[(I)$1]} == 0 ))
then
print -u$(( 2 - help )) $usage
return $(( 1 - help ))
fi
local hook="${1}_functions"
local fn="$2"
if (( del ))
then
if (( ${(P)+hook} ))
then
if (( del == 2 ))
then
set -A $hook ${(P)hook:#${~fn}}
else
set -A $hook ${(P)hook:#$fn}
fi
if (( ! ${(P)#hook} ))
then
unset $hook
fi
fi
else
if (( ${(P)+hook} ))
then
if (( ${${(P)hook}[(I)$fn]} == 0 ))
then
set -A $hook ${(P)hook} $fn
fi
else
set -A $hook $fn
fi
autoload $autoopts -- $fn
fi
}
compdump () {
# undefined
builtin autoload -XUz
}
compinit () {
emulate -L zsh
setopt extendedglob
typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1
typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name
while [[ $# -gt 0 && $1 = -[dDiuC] ]]
do
case "$1" in
(-d) _i_autodump=1
shift
if [[ $# -gt 0 && "$1" != -[dfQC] ]]
then
_i_dumpfile="$1"
shift
fi ;;
(-D) _i_autodump=0
shift ;;
(-i) _i_fail=ign
shift ;;
(-u) _i_fail=use
shift ;;
(-C) _i_check=
shift ;;
esac
done
typeset -gA _comps _services _patcomps _postpatcomps
typeset -gA _compautos
typeset -gA _lastcomp
if [[ -n $_i_dumpfile ]]
then
typeset -g _comp_dumpfile="$_i_dumpfile"
else
typeset -g _comp_dumpfile="${ZDOTDIR:-$HOME}/.zcompdump"
fi
typeset -ga _comp_options
_comp_options=(bareglobqual extendedglob glob multibyte nullglob rcexpan dparam unset NO_allexport NO_aliases NO_cshnullglob NO_cshjunkiequotes NO_errexi t NO_globsubst NO_histsubstpattern NO_ignorebraces NO_ignoreclosebraces NO_kshgl ob NO_ksharrays NO_kshtypeset NO_markdirs NO_octalzeroes NO_shwordsplit NO_shglo b NO_warncreateglobal)
typeset -g _comp_setup='local -A _comp_caller_options;
_comp_caller_options=(${(kv)options[@]});
setopt localoptions localtraps ${_comp_options[@]};
local IFS=$'\'\ \\t\\r\\n\\0\''
exec </dev/null;
trap - ZERR
local -a reply
local REPLY'
typeset -ga compprefuncs comppostfuncs
compprefuncs=()
comppostfuncs=()
: $funcstack
compdef () {
local opt autol type func delete eval new i ret=0 cmd svc
local -a match mbegin mend
emulate -L zsh
setopt extendedglob
if (( ! $# ))
then
print -u2 "$0: I need arguments"
return 1
fi
while getopts "anpPkKde" opt
do
case "$opt" in
(a) autol=yes ;;
(n) new=yes ;;
([pPkK]) if [[ -n "$type" ]]
添加zsh钩子(){
仿真-lzsh
局部-局部类型
挂钩类型=(chpwd precmd preexec周期性zshaddhistory zshexit zsh_direc tory_name)
local usage=“用法:$0钩子函数\n有效钩子是:\n$hooktypes”
本地选择
本地-自动选择
整数del列表帮助
而getopts“dDhLUzk”opt
做
案例$opt-in
(d) del=1;;
(D) del=2;;
(h) 帮助=1;;
(五十) 列表=1;;
([Uzk])自动选择+=($opt);;
(*)返回1;;
以撒
完成
班次$((可选项-1))
如果((列表))
然后
typeset-mp“(${1:-${(@j:|:)hooktypes}})\u函数”
返回美元?
elif((help |$#!=2 |${hooktypes[(I)$1]}==0))
然后
打印-u$((2-help))$使用情况
返回$((1-帮助))
fi
局部钩子=“${1}\u函数”
本地fn=“$2”
如果((del))
然后
if((${(P)+hook}))
然后
如果((del==2))
然后
set-A$hook${(P)hook:#${~fn}
其他的
set-A$hook${(P)hook:#$fn}
fi
如果(!${(P)#hook}))
然后
取消美元挂钩
fi
fi
其他的
if((${(P)+hook}))
然后
if(${(P)hook}[(I)$fn]}==0))
然后
set-A$hook${(P)hook}$fn
fi
其他的
套装-A$hook$fn
fi
自动加载$autoopts--$fn
fi
}
compdump(){
#未定义
内置自动加载-XUz
}
compinit(){
仿真-lzsh
setopt扩展全局
排版\u i\u转储文件\u i\u文件\u i\u行\u i\u完成\u i\u目录\u i\u自动转储=1
排版(i)标签(i)文件(i)添加文件(i)失败(ask)(i)检查(check)是(i)名称
而[$#-gt 0&&$1=-[dDiuC]]
做
案件“$1”
(-d)\u i\u自动转储=1
转移
如果[$#-gt 0&“$1”!=-[dfQC]]
然后
_i_dumpfile=“$1”
转移
fi;;
(-D)\u i\u自动转储=0
移位;;
(-i)\u i\u fail=ign
移位;;
(-u)\u i\u失败=使用
移位;;
(-C)检查=
移位;;
以撒
完成
排版-gA(通用公司)(通用公司)(通用公司)(通用公司)(通用公司)(通用公司)(通用公司
排版-gA_compautos
排版-gA_lastcomp
如果[-n$\u i\u dumpfile]]
然后
排版-g_comp_dumpfile=“$\u i_dumpfile”
其他的
typeset-g_comp_dumpfile=“${ZDOTDIR:-$HOME}/.zcompdump”
fi
排版-ga_comp_选项
_补偿选项=(bareglobqual扩展的glob glob glob多字节nullglob rcexpan dparam unset NO_allexport NO_别名NO_cshnullglob NO_cshjunkiequotes NO_errexi无全局子对象无历史子对象模式无符号括号无符号闭合括号无kshglob NO_ksharrays NO_kshtypeset NO_markdirs NO_八进制NO_shwordsplit NO_shglob不(全球)
typeset-g_comp_setup='local-A_comp_caller_选项;
_comp_caller_options=(${(kv)options[@]});
setopt localoptions localtraps${u comp_options[@]};
本地IFS=$'\'\\t\\r\\n\\0\''
exec我也有同样的问题。你可以看看
cat~/.zcompdump*
我得到了以下输出:
_comps=(
)
_services=(
)
_patcomps=(
)
_postpatcomps=(
)
_compautos=(
)
autoload -Uz
typeset -gUa _comp_assocs
_comp_assocs=( '' )
这意味着故障出现在autoload-Uz中。如果您在zsh中键入autoload-Uz
,您将获得准确的输出。如果这是问题所在,您可以通过更正目录权限来修复它
compaudit | xargs chown -R :Users
compaudit | xargs chmod g-w
rm ~/.zcompdump*
要进行验证,请确保compaudit没有输出任何内容。这对我有效,并修复了自动完成
链接到相关问题:它输出整个脚本?是的,我不知道它是什么脚本,但它确实输出了。我的代码由于问题中的字符限制而被截断了。@AlGFeels好像有一个坏模式等。因此,它不是运行脚本,只是对它进行了跟踪。我不确定。toy建议我做什么?@AlGI会去寻找我需要的脚本包括这个函数