git-completion icon indicating copy to clipboard operation
git-completion copied to clipboard

Feature request: put the two completion files into a folder

Open rieje opened this issue 1 year ago • 2 comments

Feature request: put the two completion files into a folder, then that folder can just be added to $fpath and there will no longer be any manual updating with cp when the plugin gets updated. Other completion plugins do this so it's just a set-and-forget setup.

I'm not sure if symlinking to a directory in your $fpath also works as a workaround, but zcompile definitely won't.

rieje avatar Sep 20 '24 20:09 rieje

You can do:

ln -s $d/git-completion/git-completion.zsh ~/.zsh/_zsh
ln -s $d/git-completion/git-completion.bash ~/.zsh/git-completion.bash

Doesn't that work?

I guess I could add a symlink on _zsh -> git-completion.zsh, but as far as I understand git-completion follows the zsh plugin standard, and it works with different plugin managers.

felipec avatar Oct 11 '24 20:10 felipec

I just mean copying or symlinking shouldn't be necessary and can be avoided by putting them together under a directory in the repo itself, then the user only needs to add that the path of that directory from the repo to their fpath. Simplifies installation step, eliminates what is otherwise unnecessary calls to external commands like cp and ln, and doesn't violate zsh plugin standard. Currently, the steps for installation require user making the directory themselves and copying/symlinking the completion files to it.

The most popular zsh completion plugin does just this, so their only step is to set fpath to fpath=(path/to/zsh-completions/src $fpath) because all their completions are under src/ in the repo.

Just do the same: create src directory in this repo, dump all git-completion* files to it, then tell users to add fpath=(path/to/git-completions/src $fpath)` from this repo. No need for copying (which would need to be repeated on update) or symlinking files.

rieje avatar Oct 15 '24 19:10 rieje

I thought the code was working for zinit, but apparently it wasn't, so I reorganized everything to put the files in a src/ directory.

It was a hassle, but it should be working now.

felipec avatar Oct 23 '24 19:10 felipec