mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2025-12-08 15:32:31 +01:00
Default strategy now tries history first and falls back to completion
This commit is contained in:
parent
82b08e2dc8
commit
c5551daabc
3 changed files with 50 additions and 16 deletions
|
|
@ -631,11 +631,28 @@ _zsh_autosuggest_strategy_completion() {
|
|||
#--------------------------------------------------------------------#
|
||||
# Default Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Will provide suggestions from your history. If no matches are found
|
||||
# in history, will provide a suggestion from the completion engine.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_strategy_default() {
|
||||
typeset -g suggestion
|
||||
|
||||
_zsh_autosuggest_strategy_history "$1"
|
||||
|
||||
if [[ -z "$suggestion" ]]; then
|
||||
_zsh_autosuggest_strategy_completion "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# History Suggestion Strategy #
|
||||
#--------------------------------------------------------------------#
|
||||
# Suggests the most recent history item that matches the given
|
||||
# prefix.
|
||||
#
|
||||
|
||||
_zsh_autosuggest_strategy_default() {
|
||||
_zsh_autosuggest_strategy_history() {
|
||||
# Reset options to defaults and enable LOCAL_OPTIONS
|
||||
emulate -L zsh
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue