启动时ZSH + OH-MY-ZSH奇文(cygwin)

时间:2014-02-07 16:10:58

标签: cygwin zsh oh-my-zsh

在我的cygwin安装上运行zsh + oh-my-zsh。每当我开始一个新的ZSH会话(新的薄荷,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" ]]

[受正文限制]

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题。你可以看看 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不输出任何内容。这对我有用,并修复了自动完成。

相关问题的链接:https://github.com/robbyrussell/oh-my-zsh/issues/630

相关问题