Merge pull request #487 from zsh-users/features/completion-ignore

Allow skipping completion suggestions when buffer matches a pattern
This commit is contained in:
Eric Freese
2020-01-04 16:52:35 -07:00
committed by GitHub
4 changed files with 42 additions and 1 deletions

View File

@@ -592,6 +592,12 @@ _zsh_autosuggest_capture_completion_async() {
}
_zsh_autosuggest_strategy_completion() {
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
# Enable extended glob for completion ignore pattern
setopt EXTENDED_GLOB
typeset -g suggestion
local line REPLY
@@ -601,6 +607,9 @@ _zsh_autosuggest_strategy_completion() {
# Exit if we don't have zpty
zmodload zsh/zpty 2>/dev/null || return
# Exit if our search string matches the ignore pattern
[[ -n "$ZSH_AUTOSUGGEST_COMPLETION_IGNORE" ]] && [[ "$1" == $~ZSH_AUTOSUGGEST_COMPLETION_IGNORE ]] && return
# Zle will be inactive if we are in async mode
if zle; then
zpty $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME _zsh_autosuggest_capture_completion_sync