z icon indicating copy to clipboard operation
z copied to clipboard

Sometimes TAB completion inserts wrong directory

Open Kentzo opened this issue 12 years ago • 6 comments

Reproducible with both zsh and bash

$z -l Cura
0.5        /Users/kent90/.virtualenvs/Cura
2          /Users/kent90/.virtualenvs/Cura/bin
344        /Users/kent90/Documents/Work/Ultimaker/Cura
$z Cura<TAB>
$z /Users/kent90

Kentzo avatar Sep 14 '13 17:09 Kentzo

did you solve this?

blackjid avatar Jan 07 '15 20:01 blackjid

ha!

no, I forgot about it.

But now that you mention it i have a pretty good idea of why that would happen, and if I'm right, it's a bug I need to fix.

rupa avatar Jan 07 '15 20:01 rupa

great!, I switch to fasd that works fine, and the .z file is compatible :) but I like that z is just a shell script that I don't have to install

blackjid avatar Jan 07 '15 21:01 blackjid

Hi @rupa I'm also getting this behaviour, at least in zsh.

After inspection it seems the problem is that zsh "smartly" performs a partial completion if all completion suggestions start with the same prefix.

So actually, on my usage, since I mostly work inside /home/user/, completion is pretty useless as I always get /home/user/ on <TAB>.

I tried adding a echo '.' on the completion section and that solves it at the cost of always showing "." as first completion candidate. However, it also seems like zsh "sorts" the completion list alphabetically, so it's no longer ordered by frecency.

If this is indeed the problem, do you have any idea of how to address this?

EDIT: So it seems using setopt menucomplete prevents the partial completion effect. Though this command affects the current shell behavior and not just the present command/completion.

As for sorted output, it's supposed to be customizable using zstyle. Still trying to find the correct command...

unode avatar Mar 06 '15 14:03 unode

Same here for bash I need to check it out.

liloman avatar May 31 '16 15:05 liloman

I've also added the tab completion for z with fzf. Check it out: https://github.com/changyuheng/fz

mrjohannchang avatar Jan 22 '19 04:01 mrjohannchang