zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.54k stars 1.87k forks source link

Suggestions are case sensitive #239

Open hiteshsharma opened 7 years ago

hiteshsharma commented 7 years ago

In my oh-my-zsh configuration case sensitivity to false but zsh-autosuggestions doesn't respects it. It should respect zsh config for case sensitivity or provide it's own config for this.

GilDev commented 7 years ago

I agree. It's pretty annoying when you have a suggestion like this: capture d ecran 2017-10-30 a 13 39 03 And then you add a “d”: capture d ecran 2017-10-30 a 13 39 25 And it doesn't autosuggest anymore…

ericfreese commented 5 years ago

How are people expecting this would work? In @GilDev's case above where he types the lowercase 'd', would you expect the plugin to suggest ocuments/Documents/Projets/...? And then on acceptance of the suggestion, go back and change the lowercase 'd' to uppercase so that the command is correct?

ericfreese commented 5 years ago

It looks like fish will actually transform the lowercase typed letter to uppercase as you type it if the letter is uppercase in the suggestion it's offering. Could go with that approach.

https://asciinema.org/a/3mSR4tvv45fzBhnj7FBzylQOd

Zarainia commented 5 years ago

Is it possible to pull directly from zsh's completion system, using whatever settings the user has set? That way it will be case-insensitive if it's set in zsh and case-sensitive if it isn't, and make use of the matcher-list and other settings.

Zarainia commented 4 years ago

I have made some changes to my version that partially implements both the version where it shows what the user typed in the case they typed it and completes to the correct case, and where it changes the typed text to the suggested, in zarainia/zsh-autosuggestions@f7e6bbabbc224cebbadb6f9ec79acb4e5d47082e. It's a little buggy when things are pasted, taken from history, etc., and you accept the suggestion, but I hope it gives you some ideas.

Currently, the settings set by the user are ignored in:

# Try to avoid any suggestions that wouldn't match the prefix
zstyle ':completion:*' matcher-list ''
zstyle ':completion:*' path-completion false

I had to change it to match my zstyle completion settings, which I just copied over (but obviously it should be pulled from the user's one or some configuration for general use). I think only the matcher-list one matters:

# edited to use actual zstyle
zstyle ':completion:*' max-errors 0 not-numeric
zstyle ':completion:*' completer _complete _approximate
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z} m:=_ m:=- m:=.'
zstyle ':completion:*' file-sort modification reverse
zstyle ':completion:*' special-dirs false

This does handle the case where the length of the suggestion is longer than the input, though I'm not sure about the other way around.

rsalmei commented 1 year ago

Yep:

image image

But, history-substring-search is not case sensitive, so, if I press UP:

image

It's a workaround.