mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-11-29 20:03:11 +01:00
Add suggestion "strategy" concept with default strategy
This commit is contained in:
1 parent
9df362f783
commit
83f78d0760
5 files changed
+51
-16
No files matched your search
@@ -0,0 +1,17 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Default Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggests the most recent history item that matches the given
|
||||
# prefix.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_strategy_default() {
|
||||
local prefix="$(_zsh_autosuggest_escape_command_prefix "$1")"
|
||||
|
||||
# Get the hist number of the most recent history item that matches
|
||||
local histkey="${${(k)history[(R)$prefix*]}[1]}"
|
||||
|
||||
# Echo the history entry
|
||||
echo -E "${history[$histkey]}"
|
||||
}
|
||||
Reference in new issue
Block a user