mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
default => history
This commit is contained in:
parent
4540304fa0
commit
62f5f14f2f
6 changed files with 9 additions and 9 deletions
|
@ -41,7 +41,7 @@ Set `ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE` to configure the style that the suggestion
|
|||
|
||||
Set `ZSH_AUTOSUGGEST_STRATEGY` to choose the strategy for generating suggestions. There are currently two to choose from:
|
||||
|
||||
- `default`: Chooses the most recent match.
|
||||
- `history`: Chooses the most recent match from history.
|
||||
- `match_prev_cmd`: Chooses the most recent match whose preceding history item matches the most recently executed command ([more info](src/strategies/match_prev_cmd.zsh)). 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`.
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ describe 'using `zle -U`' do
|
|||
let(:before_sourcing) do
|
||||
-> do
|
||||
session.
|
||||
run_command('_zsh_autosuggest_strategy_test() { sleep 1; _zsh_autosuggest_strategy_default "$1" }').
|
||||
run_command('_zsh_autosuggest_strategy_test() { sleep 1; _zsh_autosuggest_strategy_history "$1" }').
|
||||
run_command('foo() { zle -U - "echo hello" }; zle -N foo; bindkey ^B foo')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
describe 'a suggestion for a given prefix' do
|
||||
let(:options) { ['_zsh_autosuggest_strategy_default() { suggestion="echo foo" }'] }
|
||||
let(:options) { ['_zsh_autosuggest_strategy_history() { suggestion="echo foo" }'] }
|
||||
|
||||
it 'is determined by calling the default strategy function' do
|
||||
session.send_string('e')
|
||||
|
|
|
@ -11,7 +11,7 @@ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
|||
# Prefix to use when saving original versions of bound widgets
|
||||
ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
|
||||
|
||||
ZSH_AUTOSUGGEST_STRATEGY=default
|
||||
ZSH_AUTOSUGGEST_STRATEGY=history
|
||||
|
||||
# Widgets that clear the suggestion
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
#--------------------------------------------------------------------#
|
||||
# Default Suggestion Strategy #
|
||||
# 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
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
|
|||
# Prefix to use when saving original versions of bound widgets
|
||||
ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
|
||||
|
||||
ZSH_AUTOSUGGEST_STRATEGY=default
|
||||
ZSH_AUTOSUGGEST_STRATEGY=history
|
||||
|
||||
# Widgets that clear the suggestion
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(
|
||||
|
@ -500,13 +500,13 @@ zle -N autosuggest-disable _zsh_autosuggest_widget_disable
|
|||
zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Default Suggestion Strategy #
|
||||
# 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…
Reference in a new issue