Open hiteshsharma opened 7 years ago
I agree. It's pretty annoying when you have a suggestion like this: And then you add a “d”: 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.
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.
Yep:
But, history-substring-search
is not case sensitive, so, if I press UP:
It's a workaround.
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.