Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to get branch completions when writing 'gd'? #419

Open
yuvals1 opened this issue Jan 17, 2025 · 5 comments
Open

is it possible to get branch completions when writing 'gd'? #419

yuvals1 opened this issue Jan 17, 2025 · 5 comments

Comments

@yuvals1
Copy link

yuvals1 commented Jan 17, 2025

No description provided.

@sandr01d
Copy link
Collaborator

sandr01d commented Jan 17, 2025

Hey @yuvals1! We essentially make use of the completions provided by git, which include branches for diff. Which shell are you using? If you're using fish, this might be related to #418.

@yuvals1
Copy link
Author

yuvals1 commented Jan 19, 2025

how exactly are forgit completions supposed to work? i have good completions for git.

i have this line in my zshrc for forgiit:
[ -f $HOMEBREW_PREFIX/share/forgit/forgit.plugin.zsh ] && source $HOMEBREW_PREFIX/share/forgit/forgit.plugin.zsh

and unless i explicitly add compdef _git_diff forgit::diff (for gd for example), the completions don't work.

i also have zinit snippet OMZP::git. maybe it interferes with forgit completions somehow?

@sandr01d
Copy link
Collaborator

I'm assuming you're using zsh and installed fzf through brew from your previous response. Is that correct?

how exactly are forgit completions supposed to work?

The only step necessary for working completions with zsh is that completions/_git-forgit has to be placed in a directory that is in your $fpath. The brew installation script handles that for you. completions/_git-forgit handles the necessary compdef bindings.

To make sure that completions/_git-forgit is present in you $fpath could you please run the following in your zsh and send me the results?

for line in $fpath; do grep _git-add "$line/"**/*(-.); done

i also have zinit snippet OMZP::git. maybe it interferes with forgit completions somehow?

We had a user that had similar issues with zinit previously. Please take a look at #330 and see if something in there helps.

@yuvals1
Copy link
Author

yuvals1 commented Jan 19, 2025

❯ for line in $fpath; do grep _git-add "$line/"**/*(-.); done
/usr/local/share/zsh/site-functions/_git-forgit:    add) _git-add ;;
/usr/local/share/zsh/site-functions/_git-forgit:(( $+functions[_git-add] )) || _git
/usr/local/share/zsh/site-functions/_git-forgit:(( $+functions[_git-add] )) || return 1
/usr/local/share/zsh/site-functions/_git-forgit:compdef _git-add forgit::add
/usr/local/share/zsh/site-functions/_git-forgit:    add) _git-add ;;
/usr/local/share/zsh/site-functions/_git-forgit:(( $+functions[_git-add] )) || _git
/usr/local/share/zsh/site-functions/_git-forgit:(( $+functions[_git-add] )) || return 1
/usr/local/share/zsh/site-functions/_git-forgit:compdef _git-add forgit::add
zsh: no matches found: /usr/share/zsh/site-functions/**/*(-.)
/usr/share/zsh/5.9/functions/_git:(( $+functions[_git-add] )) ||
/usr/share/zsh/5.9/functions/_git:_git-add () {

is that the desired output?

@sandr01d
Copy link
Collaborator

is that the desired output?

Yes. This means forgit completions are correctly placed inside you $fpath. Compsys should handle the rest from there. My guess would be that the issue is caused by zinit in some way. Could you try to build a simple .zshrc file without zinit that simply sources forgit.plugin.zsh and see if that works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants