zsh-autocomplete icon indicating copy to clipboard operation
zsh-autocomplete copied to clipboard

Incompatibility with zoxide z <space><tab> shortcut

Open aacebedo opened this issue 3 months ago • 7 comments

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
  • Operating system: NixOS
  • Terminal emulator: Alacritty

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 avatar Mar 22 '24 22:03 aacebedo

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 avatar Mar 23 '24 17:03 aacebedo

Here is a gif showing the issue test

aacebedo avatar Mar 24 '24 12:03 aacebedo

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

argamanza avatar Apr 02 '24 16:04 argamanza

@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.

ad-on-is avatar Apr 20 '24 17:04 ad-on-is

@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.

aacebedo avatar Apr 20 '24 18:04 aacebedo