美文网首页
Mac系统按tab键git自动补齐

Mac系统按tab键git自动补齐

作者: andforce | 来源:发表于2023-02-17 02:51 被阅读0次

    如果你用的是zsh

    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ~/.git-completion.zsh
    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
    mkdir -p ~/.zsh/functions && cp ~/.git-completion.zsh ~/.zsh/functions/_git
    

    ~/.zshrc中添加:

    zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
    # `compinit` scans $fpath, so do this before calling it.
    fpath=(~/.zsh/functions $fpath)
    autoload -Uz compinit && compinit
    

    参考:
    https://stackoverflow.com/questions/28028740/git-tab-completion-in-zsh-throwing-errors

    如果你用的是bash:

    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
    

    ~/.bash_profile中添加:

    if [ -f ~/.git-completion.bash ]; then
        . ~/.git-completion.bash
    fi
    
    source ~/.bash_profile
    

    相关文章

      网友评论

          本文标题:Mac系统按tab键git自动补齐

          本文链接:https://www.haomeiwen.com/subject/vdsmkdtx.html