From 9bf1ae66bc94d246daf9537f8f1ade6b36619775 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 19 Sep 2021 18:59:54 +0800 Subject: [PATCH] feat(history-substring-search): add `prefixed` setting support zsh-history-substring-search `HISTORY_SUBSTRING_SEARCH_PREFIXED` env Signed-off-by: mritd --- modules/history-substring-search/README.md | 6 ++++++ modules/history-substring-search/init.zsh | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/modules/history-substring-search/README.md b/modules/history-substring-search/README.md index 42919e0..3284110 100644 --- a/modules/history-substring-search/README.md +++ b/modules/history-substring-search/README.md @@ -63,6 +63,12 @@ _`${ZDOTDIR:-$HOME}/.zpreztorc`_: ```sh zstyle ':prezto:module:history-substring-search' globbing-flags '' + +To set the search matched against the start of each history entry, add the following line to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_: + +```sh +zstyle ':prezto:module:history-substring-search' prefixed 'yes' ``` ### Fuzzy search diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh index d287ae4..3748325 100644 --- a/modules/history-substring-search/init.zsh +++ b/modules/history-substring-search/init.zsh @@ -34,6 +34,10 @@ if zstyle -t ':prezto:module:history-substring-search' case-sensitive; then HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS="${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS//i}" fi +if zstyle -t ':prezto:module:history-substring-search' prefixed; then + HISTORY_SUBSTRING_SEARCH_PREFIXED='true' +fi + if ! zstyle -t ':prezto:module:history-substring-search' color; then unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_{FOUND,NOT_FOUND} fi