marlonrichert / zsh-autocomplete

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

Recent dir completions can mask local file completions #640

Closed magnusanderson-wk closed 5 months ago

magnusanderson-wk commented 1 year ago

What do you want?

With normal ZSH, it is possible to have case insensitive matching. This is a very nice feature.

You can normally configure it like

autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'

In general, it would be even cooler to also be able to do fuzzy matching, like if the following are options:

123-abc
234-bcd
345-cDe

then typing d would show 234-bcd and 345-cDe

But just supporting regular zsh completion would be a good start

Why do you want this?

Letter case shouldn't be something humans worry about

Who else would benefit from this?

Nearly everyone on a case-sensitive file system

How should it work?

Respect zstyle ':completion:*' or explain how to get it to work

marlonrichert commented 1 year ago

It already works like that:

% cd $(mktemp -d)
% git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
Cloning into 'zsh-autocomplete'...
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 55 (delta 0), reused 33 (delta 0), pack-reused 0
Receiving objects: 100% (55/55), 1.64 MiB | 2.88 MiB/s, done.
% > .zshrc <<EOF
setopt interactivecomments transientrprompt
PS1='%# '
PS2=
RPS2='%^'
source $PWD/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
% env -i HOME=$PWD PATH=$PATH TERM=$TERM ${TERMINFO:+TERMINFO=$TERMINFO} zsh -d
% touch 123-abc 234-bcd 345-cDe
% file d
file
234-bcd  345-cDe
common substring: ccd

However, in an environment where there are recent dirs that can be shown as completions, these can get in the way of showing local files. That needs to be fixed.