zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.11k stars 1.86k forks source link

`ZSH_AUTOSUGGEST_COMPLETION_IGNORE` alternative to ignore the suggestion, not the buffer #657

Open chrisgrieser opened 2 years ago

chrisgrieser commented 2 years ago

Is your feature request related to a problem? Please describe.

It took me a bit to realize that ZSH_AUTOSUGGEST_COMPLETION_IGNORE and ZSH_AUTOSUGGEST_HISTORY_IGNORE actually work different, the former ignores based on the buffer (= what you already typed), while the latter ignores based on the history entries (= what would be suggested).

Describe the solution you'd like

A method to ignore suggestions that would be made based on completions, basically the equivalent to the history-ignore-logic (ignore based a pattern matching the suggestions, not the buffer.)

Example: One use case is to ignore certain files: Mac for example regularly stores those .DS_Store files everywhere and they get suggested regularly when I have something that concerns a file. Could be open, could be git add in the buffer, so the current implementation of ZSH_AUTOSUGGEST_COMPLETION_IGNORE is not suited to prevent the suggesting of that file.

Maybe add something like ZSH_AUTOSUGGEST_COMPLETION_SUGGESTION_IGNORE?

Describe alternatives you've considered

I couldn't think of a glob pattern that would do what I want with the current implementation of ZSH_AUTOSUGGEST_COMPLETION_IGNORE.

ericfreese commented 2 years ago

Would you want tab completion to suggest those files? If not, you might try configuring the zsh completion system to omit those files. Once completion is configured not to try those files, this plug in will not try them as a suggestion. I don't know off the top of my head how to do this but a quick Google found this that might get you started: https://stackoverflow.com/questions/67222730/how-do-i-always-ignore-a-pattern-in-zsh-completion