ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
20.54k stars 523 forks source link

smart autocomplete from zsh #727

Open williamokano opened 4 months ago

williamokano commented 4 months ago

Context

I tried using zoxide as replacament for cd using init --cmd cd and I found a few differences that are annoying after a few years of using the default zsh cd syntax.

Imagine I have the following directories:

xp-foo-bar
xp-infra-charts
xp-infra-drone
xp-infra-terraform
xp-tf-infra-ips
xp-something-else

In zsh cd, if I type infra and hit tab, it will autocomplete the common part, which is -infra- (but it's not as useful) but if I hit tab again, it will show the options (and let me navigate it) only for the matching part.

I think it goes kind of hand in hand of what zoxide proposes for smart navigation, as sometimes I have too many directories and I only remember part of the name.

In this case I was just using zoxide to start populating some data/directories into database, but the navigation of unknown directories to zoxide become poorer.

Another example would be "cd something", it would check that there's only 1 matching something and autocomplete, on tab, the whole directory for me.

Expectations

cd infra<TAB> would list all the directories in the current level matching infra on its name cd something<TAB> would autofill xp-something-else for me.

Actual Results

cd infra<TAB> do nothing cd something<TAB> do nothing

Notes

I tried the compinit as mentioned on several issues:

Nothing helped.

Versions

zsh 5.9 (x86_64-apple-darwin23.0) zoxide 0.9.4 fzf 0.43.0 (brew) omz master (15ffbdd) macOS 14.3.1 23D60 arm64

williamokano commented 4 months ago

Seems related to https://github.com/ajeetdsouza/zoxide/issues/712

sabattle commented 1 month ago

seeing the same behavior. I use the substring matching from zsh completion pretty heavily so its a shame this doesn't work in zoxide.

@ajeetdsouza is it expected that zoxide can't autocomplete substrings after pressing tab like the base cd command? or is this just a misconfiguration on our part? would love if zoxide could just inherit all completion zstyles that cd uses