Lots of async changes

This commit is contained in:
Eric Freese
2017-02-16 19:18:03 -07:00
parent 38eb7cdafd
commit ed8056c5e8
35 changed files with 384 additions and 1133 deletions

View File

@@ -7,14 +7,19 @@
#
_zsh_autosuggest_strategy_default() {
setopt localoptions EXTENDED_GLOB
# Reset options to defaults and enable LOCAL_OPTIONS
emulate -L zsh
local prefix="${1//(#m)[\\()\[\]|*?~]/\\$MATCH}"
# Enable globbing flags so that we can use (#m)
setopt EXTENDED_GLOB
# Get the keys of the history items that match
local -a histkeys
histkeys=(${(k)history[(r)$prefix*]})
# Escape backslashes and all of the glob operators so we can use
# this string as a pattern to search the $history associative array.
# - (#m) globbing flag enables setting references for match data
local prefix="${1//(#m)[\\*?[\]<>()|^~#]/\\$MATCH}"
# Get the history items that match
# - (r) subscript flag makes the pattern match on values
suggestion="${history[(r)$prefix*]}"
# Give back the value of the first key
suggestion="${history[$histkeys[1]]}"
}