Zsh-autosuggestions: Suggestions are case sensitive

Created on 11 May 2017  ·  5Comments  ·  Source: zsh-users/zsh-autosuggestions

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.

enhancement pull-request-welcome suggestion-engine

Most helpful comment

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…

All 5 comments

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…

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?

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

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fgr0 picture fgr0  ·  3Comments

guitaristtom picture guitaristtom  ·  6Comments

silverneko picture silverneko  ·  5Comments

metalmac picture metalmac  ·  4Comments

mehedi-sharif picture mehedi-sharif  ·  6Comments