How can I enable git-flow-completion in oh-my-zsh?
Asked Answered
P

3

11

I'm using oh-my-zsh and attempting to enable git-flow-completion. I'm following the instructions here to install it as a plugin.

I cloned the plugin files as instructed:

git clone https://github.com/bobthecow/git-flow-completion ~/.oh-my-zsh/custom/plugins/git-flow-completion

My plugin directory structure looks identical to the example in the installation instructions.

I've edited my ~/.zshrc file to include:

plugins=(git git-flow git-flow-completion)

However, git flow completion is not working. When I type git flow and hit tab, I get a list of files in the current directory instead of the git flow subcommands.

The built-in plugins work fine. I edited my ~/.zshrc to include:

plugins=(git git-flow git-flow-completion emoji emoji-clock)

When I open a new terminal, the random_emoji and emoji-clock functions produce the expected output, but git flow completion still does not work.

I've added my existing PATH to my .zshrc above the line that loads oh-my-zsh.sh. No luck.

I've checked the value of $ZSH_CUSTOM and it is pointing to the directory where the git-flow-completion plugin is installed.

I wanted to know if custom plugins were being loaded at all, so I installed this auto-stats plugin and it worked correctly, so this problem seems to be isolated to the git-flow-completion plugin.

I've also tried loading the plugin file directly:

source ~/.oh-my-zsh/custom/plugins/git-flow-completion/git-flow-completion.zsh

There was no output from this command, and completion still does not work.

How can I go about troubleshooting this issue?

Parietal answered 24/10, 2016 at 22:34 Comment(0)
S
11

This was a nasty problem ... but I got it fixed.

First remove these two file:

rm /usr/local/share/zsh/site-functions/_git
rm /usr/local/etc/bash_completion.d/git-flow-completion.bash

Then reset the completion cache:

# Delete the completion cache
rm "$ZSH_COMPDUMP"
# Restart the zsh session
exec zsh
Souse answered 8/9, 2020 at 13:40 Comment(1)
Found the reference to this solution on nickdenardis.com/2020/10/25/… He/She explains very well the problem and the solution. ThanksGigue
P
2

I was facing the same problem and no amount of updating helped. What did the trick in the end was commenting the default git completion (found in ~/.oh-my-zsh/plugins/git/git.plugin.zsh) with the one found here. I basically followed the instructions from here.

EDIT: I would like to point out that this "fix" has broken my git completion for git push -u origin [BRANCH] as it now completes from git push -u or to

git push -u or__git_remote_repositories:4: command not found _ssh_hosts
igin

Poussette answered 17/2, 2019 at 15:45 Comment(0)
C
0
rm /usr/local/etc/bash_completion.d/git-flow-completion.bash

It works for me.

Concurrent answered 23/8, 2020 at 13:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.