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

Suggestions are case sensitive

Open hiteshsharma opened this issue 8 years ago • 6 comments

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.

hiteshsharma avatar May 11 '17 20:05 hiteshsharma

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…

GilDev avatar Oct 30 '17 12:10 GilDev

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 avatar Apr 10 '19 18:04 ericfreese

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

ericfreese avatar Apr 10 '19 18:04 ericfreese

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 avatar Oct 25 '19 00:10 Zarainia

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.

Zarainia avatar Feb 09 '20 16:02 Zarainia

Yep: image image

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

It's a workaround.

rsalmei avatar Mar 19 '23 03:03 rsalmei