-
Notifications
You must be signed in to change notification settings - Fork 555
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
zsh cd completions duplicate with group-name enabled #491
Comments
For reference, this is how to reproduce: $ cd $(mktemp -d)
$ touch .zshrc
$ ZDOTDIR=${PWD} HOME=${PWD} exec zsh
$ autoload -Uz compinit && compinit -C
$ eval "$(zoxide init zsh)"
$ zstyle ':completion:*' format '%F{yellow}-- %d --%f'
$ zstyle ':completion:*' group-name ''
$ mkdir test{1,2}
$ z test<TAB>
-- file --
test1/ test2/
-- file --
test1/ test2/ @grimm26, I noticed it works as expected if you do
|
@ericbn You are correct! I have no idea how/why but it works. Maybe just a documentation change is needed? |
FWIW, |
noticed [this error](ajeetdsouza/zoxide#491), and fixed it in my dotfiles.
I'm also experiencing this issue, but calling |
I found a solution haha. |
That's not a solution, this makes it so the completions for zoxide will be the completions of vim. |
Same |
For anyone looking for a workaround, I got things working by replacing Here's the full completions snippet with the fix: # Completions.
if [[ -o zle ]]; then
function __zoxide_z_complete() {
# Only show completions when the cursor is at the end of the line.
# shellcheck disable=SC2154
[[ "${#words[@]}" -eq "${CURRENT}" ]] || return 0
if [[ "${#words[@]}" -eq 2 ]]; then
# call _path_files directly to avoid duplication issue #491
_path_files -/
elif [[ "${words[-1]}" == '' ]] && [[ "${words[-2]}" != "${__zoxide_z_prefix}"?* ]]; then
\builtin local result
# shellcheck disable=SC2086,SC2312
if result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- ${words[2,-1]})"; then
result="${__zoxide_z_prefix}${result}"
# shellcheck disable=SC2296
compadd -Q "${(q-)result}"
fi
\builtin printf '\e[5n'
fi
return 0
}
\builtin bindkey '\e[0n' 'reset-prompt'
[[ "${+functions[compdef]}" -ne 0 ]] && \compdef __zoxide_z_complete __zoxide_z
fi |
this bug is quite annoying, I'm surprised more people have not been running into it |
This solved it for me #787 |
I do notice that using |
Yes, nevermind my previous comment. Not sure where my head was. I remember considering just applying the builtin autocompletion (like the PR does) and then discarding it for |
I met this problem too. As @urob mentioned you shouldn't change the autocomplete behaviour, but changing the |
I stripped down my completions setup in zshrc to be just:
Now, I add a format and group-name setting and the strange behavior starts.
When using
cd
tab completion, I get expected suggestions. When usingz
, I get a duplicate set of suggestions.The text was updated successfully, but these errors were encountered: