marlonrichert / zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
MIT License
5.01k stars 143 forks source link

Incompatibility with zoxide z <space><tab> shortcut #706

Open aacebedo opened 3 months ago

aacebedo commented 3 months ago

When installing and using zsh-autocomplete with z-shell/zsh-zoxide, zoxide command is repeated 4 times when using the shorcut z <directory-to-search><SPACE><TAB>

and does not validate in the end

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace
typeset VENDOR=pc
typeset OSTYPE=linux-gnu
typeset ZSH_PATCHLEVEL=zsh-5.9-0-g73d3173
typeset -a _autocomplete__funcfiletrace=(
  /home/aacebedo/.zi/plugins/marlonrichert---zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
  /home/aacebedo/.zi/bin/zi.zsh:1623
  /home/aacebedo/.zi/bin/zi.zsh:1516
  /home/aacebedo/.zi/bin/zi.zsh:1215
  /home/aacebedo/.zi/bin/zi.zsh:2507
  /home/aacebedo/.zshrc:7
  zsh:0
)
% git -C ~autocomplete log --oneline -n1
c7b6550 (HEAD -> main, origin/main, origin/HEAD) Add instructions on how to insert longest common prefix

Steps to reproduce

% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
<output>
% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
if [ ! -d ~/.zi ]; then
  source <(curl -sL init.zshell.dev); zzinit
fi
. ~/.zi/bin/zi.zsh
mkdir -p ~/.zi/completions
zi ice depth "1"
zi load romkatv/powerlevel10k
zi load marlonrichert/zsh-autocomplete
zi load z-shell/zsh-zoxide
zi cdreplay -q
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
% cd /etc
% x e<SPACE><TAB>
x /etc
x /etc
x /etc
x /etc
aacebedo commented 3 months ago

After digging more on this, I noticed this behaviour with zoxide directly. I think something has changed on 0.9.4 that leads to this problem.

EDIT: Tried with 0.9.2 same behaviour.

aacebedo commented 3 months ago

Here is a gif showing the issue test

argamanza commented 3 months ago

Didn't notice this issue and created #709 - any updates?

ad-on-is commented 2 months ago

@aacebedo Slightly off topic, but... I noticed your .zshrc has the following lines

if [ ! -d ~/.zi ]; then
  source <(curl -sL init.zshell.dev); zzinit
fi

Which imposes a high security issue... What if init.zshell.dev at some point serves a very malicious script. If I were you, I'd remove that, and other similar scripts if you have any.

aacebedo commented 2 months ago

@aacebedo Slightly off topic, but... I noticed your .zshrc has the following lines

if [ ! -d ~/.zi ]; then
  source <(curl -sL init.zshell.dev); zzinit
fi

Which imposes a high security issue... What if init.zshell.dev at some point serves a very malicious script. If I were you, I'd remove that, and other similar scripts if you have any.

Thanks for the remark. You are right I will modify this and keep a copy of the install script locally instead.

marlonrichert commented 4 weeks ago

I'm not able to reproduce this with the latest version of Autocomplete. Can you update and try again?

aacebedo commented 1 week ago

unfortunately the problem is still there. Which version of zoxide do you use?