@ -22,17 +22,18 @@ in
} ;
strategy = mkOption {
type = types . enum [ " h i s t o r y " " m a t c h _ p r e v _ c m d " ] ;
default = "h i s t o r y " ;
type = types . listOf ( types . enum [ " h i s t o r y " " c o m p l e t i o n " " ma t c h _ p r e v _ c m d " ] ) ;
default = [ "h i s t o r y " ] ;
description = ''
Set ZSH_AUTOSUGGEST_STRATEGY to choose the strategy for generating suggestions .
There are currently two to choose from :
` ZSH_AUTOSUGGEST_STRATEGY ` is an array that specifies how suggestions should be generated .
The strategies in the array are tried successively until a suggestion is found .
There are currently three built-in strategies to choose from :
* history : Chooses the most recent match .
* match_prev_cmd : Chooses the most recent match whose preceding history item matches
the most recently executed command ( more info ) . Note that this strategy won't work a s
expected with ZSH options that don't preserve the history order such as
HIST_IGNORE_ALL_DUPS or HIST_EXPIRE_DUPS_FIRST .
- ` history ` : Chooses the most recent match from history .
- ` completion ` : Chooses a suggestion based on what tab-completion would suggest . ( requires ` zpty ` module )
- ` match_prev_cmd ` : Like ` history ` , but chooses the most recent match whose preceding history item matche s
the most recently executed command . Note that this strategy won't work as expected with ZSH options that
don't preserve the history order such as ` HIST_IGNORE_ALL_DUPS ` or ` HIST_EXPIRE_DUPS_FIRST ` .
'' ;
} ;
@ -62,7 +63,7 @@ in
source $ { pkgs . zsh-autosuggestions } /share/zsh-autosuggestions/zsh-autosuggestions.zsh
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = " ${ cfg . highlightStyle } "
export ZSH_AUTOSUGGEST_STRATEGY = ( " ${ cfg . strategy } " )
export ZSH_AUTOSUGGEST_STRATEGY = ( $ { concatStringsSep " " cfg . strategy } )
$ { optionalString ( ! cfg . async ) " u n s e t Z S H _ A U T O S U G G E S T _ U S E _ A S Y N C " }
$ { concatStringsSep " \n " ( mapAttrsToList ( key : value : '' e x p o r t ${ key } = " ${ value } " '' ) cfg . extraConfig ) }