首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ZSH + OH-MY-ZSH启动时的奇数文本(cygwin)

ZSH + OH-MY-ZSH启动时的奇数文本(cygwin)
EN

Stack Overflow用户
提问于 2014-02-08 00:10:58
回答 1查看 1.1K关注 0票数 0

在我的cygwin安装上运行zsh +哦- my -zsh。每当我开始一个新的ZSH会话(new mintty、tmux等)它输出下面的文本。我不认为它会影响ZSH的性能,但它是超级恼人的。

代码语言:javascript
复制
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" ]]

受正文文本限制

EN

回答 1

Stack Overflow用户

发布于 2014-04-11 15:12:53

我也有同样的问题。你可以看看cat ~/.zcompdump*,我得到了下面的输出:

代码语言:javascript
复制
_comps=(
)

_services=(
)

_patcomps=(
)

_postpatcomps=(
)

_compautos=(
)


autoload -Uz

typeset -gUa _comp_assocs
_comp_assocs=( '' )

这意味着故障发生在自动加载-Uz中。如果您在zsh中键入autoload -Uz,您将得到准确的输出。如果这就是问题所在,您可以通过更正目录权限来修复它。

代码语言:javascript
复制
compaudit | xargs chown -R :Users
compaudit | xargs chmod g-w
rm ~/.zcompdump*

要进行验证,请确保compaudit没有输出任何内容。这对我来说很有效,并修复了自动完成。

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21632535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档