From 5ac930d96be3a51730f7d9d7330f28d9c9c36e0a Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Mon, 11 Sep 2023 23:28:38 -0500 Subject: [PATCH] history-substring-search: Tweak documentation and cleanup --- modules/history-substring-search/README.md | 26 ++++++++++++++++------ modules/history-substring-search/init.zsh | 10 ++++----- runcoms/zpreztorc | 11 +++++---- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/modules/history-substring-search/README.md b/modules/history-substring-search/README.md index 32841106..e7c55c53 100644 --- a/modules/history-substring-search/README.md +++ b/modules/history-substring-search/README.md @@ -63,18 +63,21 @@ _`${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 +### Case sensitive search + +To set the search case-sensitivity, add the following line to _`${ZDOTDIR:-$HOME}/.zpreztorc`_: ```sh -zstyle ':prezto:module:history-substring-search' prefixed 'yes' +zstyle ':prezto:module:history-substring-search' case-sensitive 'yes' ``` ### Fuzzy search -To enable fuzzy search add the following line to -`${ZDOTDIR:-$HOME}/.zpreztorc`_: +To enable search for fuzzy matches, add the following line to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_: ```sh zstyle ':prezto:module:history-substring-search' fuzzy 'yes' @@ -82,11 +85,20 @@ zstyle ':prezto:module:history-substring-search' fuzzy 'yes' ### Unique results -To retrieve only unique results (remove duplicates) add the following line to -`${ZDOTDIR:-$HOME}/.zpreztorc`_: +To enable unique results, add the following line to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_: ```sh -zstyle ':prezto:module:history-substring-search' ensure-unique 'yes' +zstyle ':prezto:module:history-substring-search' unique 'yes' +``` + +### Prefixed search + +To enable prefixed search matches, add the following line to +_`${ZDOTDIR:-$HOME}/.zpreztorc`_: + +```sh +zstyle ':prezto:module:history-substring-search' prefixed 'yes' ``` ## Authors diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh index 37483255..54e8b00e 100644 --- a/modules/history-substring-search/init.zsh +++ b/modules/history-substring-search/init.zsh @@ -34,10 +34,6 @@ 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 @@ -46,10 +42,14 @@ if zstyle -t ':prezto:module:history-substring-search' fuzzy; then HISTORY_SUBSTRING_SEARCH_FUZZY=1 fi -if zstyle -t ':prezto:module:history-substring-search' ensure-unique; then +if zstyle -t ':prezto:module:history-substring-search' unique; then HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 fi +if zstyle -t ':prezto:module:history-substring-search' prefixed; then + HISTORY_SUBSTRING_SEARCH_PREFIXED=1 +fi + # # Key Bindings # diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 2df7c73e..b37c4313 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -109,13 +109,16 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Set the search globbing flags. # zstyle ':prezto:module:history-substring-search' globbing-flags '' -# Enable fuzzy search +# Enable search case-sensitivity. +# zstyle ':prezto:module:history-substring-search' case-sensitive 'yes' + +# Enable search for fuzzy matches. # zstyle ':prezto:module:history-substring-search' fuzzy 'yes' -# Retrieve only unique results (removes duplicates) -# zstyle ':prezto:module:history-substring-search' ensure-unique 'yes' +# Enable search uniqueness. +# zstyle ':prezto:module:history-substring-search' unique 'yes' -# Set the search prefixed. +# Enable prefixed search. # zstyle ':prezto:module:history-substring-search' prefixed 'yes' #