Repository navigation
pr-git-2216/fionn/zsh-completion-exclude-v1
tagged this
03 Oct 11:22
From: Fionn Fitzmaurice <git@fionn.email>
When using the _git completion function bundled with Zsh
(https://sf.net/p/zsh/code/ci/master/tree/Completion/Unix/Command/_git),
duplicate files in an argument list will not be offered as completion
candidates.
For example, suppose we have untracked files aa and ab (only). Then with
the Zsh completion,
git add aa a<tab>
would not offer both aa and ab as completion candidates, rather it would
complete ab only.
This behaviour is not present in git-completion.zsh shipped with Git,
which does not deduplicate arguments.
We can get this with minor changes, however. Here we introduce an array
__git_file_exclude which we populate with existing arguments and then
tell compadd to exclude them, which closely matches the Zsh _git
completion behaviour (as well as common programs such as rm).
Signed-off-by: Fionn Fitzmaurice <git@fionn.email>
Submitted-As: https://lore.kernel.org/git/pull.2216.git.git.1791026527023.gitgitgadget@gmail.com