Giter Site home page Giter Site logo

Comments (12)

akinomyoga avatar akinomyoga commented on June 26, 2024

Do you have git in the array completions defined in ~/.bashrc? The completion module is only loaded when it is registered to the array completions in ~/.bashrc before sourcing oh-my-bash.sh

3. Source bashrc (which sources oh-my-bash.sh script)

Another possibility would be that the git completion is loaded but the actual processing is kipped because a function __gitdir is already defined. Did you source ~/.bashrc in a session where OMB is already loaded? Could you check the behavior when you start a new Bash session?

from oh-my-bash.

atrestis avatar atrestis commented on June 26, 2024

Do you have git in the array completions defined in ~/.bashrc? The completion module is only loaded when it is registered to the array completions in ~/.bashrc before sourcing oh-my-bash.sh

Correct, git is in array completions, defined in bashrc.

Another possibility would be that the git completion is loaded but the actual processing is kipped because a function __gitdir is already defined. Did you source ~/.bashrc in a session where OMB is already loaded? Could you check the behavior when you start a new Bash session?

I did check, same behavior, it only loads aliases on ~/.gitconfig, not commonly used commands like status and commit.

from oh-my-bash.

akinomyoga avatar akinomyoga commented on June 26, 2024

Thanks.

What is the result of the following command in the session where the completion settings are not correctly loaded?

$ complete -p git

Also, could you share the content of the custom git completion file (after your modification)?

from oh-my-bash.

atrestis avatar atrestis commented on June 26, 2024

What is the result of the following command in the session where the completion settings are not correctly loaded?

$ complete -p git

This is the result.
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git

Also, could you share the content of the custom git completion file (after your modification)?

Sure, this is the content of ~/.ohmybash/custom/completions/git.completion.bash:

#! bash oh-my-bash.module
# bash completion support for Git.
function _omb_completion_git_initialize {
    if ! _omb_util_function_exists __gitdir; then
        local git_paths path
        IFS=$'\n' read -r -d '' -a git_paths <<< "$(type -aP git)"
        # Note: Falling back on /usr (should already be in the array)
        git_paths+=("/nfs/devel/tools/git/2.35.2/bin/git")
        for path in "${git_paths[@]}"; do
            if [[ -L $path ]]; then
                path=$(_omb_util_readlink "$path")
            fi
            # Note: In the case of symbolic link, the true binary name can
            # contain prefix or suffix for architectures and versions.
            path="${path%/*}"
            local files
            local prefix="${path%/bin}" file
            _omb_util_glob_expand files '"$prefix"/share/{bash-completion/completions/git,{,doc/}git-*/contrib/completion/git-completion.bash}'
            for file in "${files[@]}"; do
                if [[ -f $file && -r $file && -s $file ]]; then
                    source "$file"
                    return $?
                fi
            done
        done
        source "$OSH/tools/git-completion.bash"
    fi
}
_omb_completion_git_initialize
unset -f _omb_completion_git_initialize

from oh-my-bash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.