0

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                                                                                                                                                                                                  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" ]]

【本文限定】

4

1 に答える 1

2

同じ問題が発生しました。 cat ~/.zcompdump* そして、次の出力が得られたことを確認できます 。

_comps=(
)

_services=(
)

_patcomps=(
)

_postpatcomps=(
)

_compautos=(
)


autoload -Uz

typeset -gUa _comp_assocs
_comp_assocs=( '' )

これは、障害が autoload -Uz にあることを意味します。autoload -Uzzsh を入力すると、正確な出力が得られます。それが問題である場合は、ディレクトリのアクセス許可を修正することで修正できます。

compaudit | xargs chown -R :Users
compaudit | xargs chmod g-w
rm ~/.zcompdump*

確認するには、compaudit が何も出力していないことを確認します。これは私にとってはうまくいき、オートコンプリートを修正しました。

関連する問題へのリンク: https://github.com/robbyrussell/oh-my-zsh/issues/630

于 2014-04-11T07:12:53.207 に答える