diff --git a/modules/history-substring-search/README.md b/modules/history-substring-search/README.md index 6bfe4e6..27a4a78 100644 --- a/modules/history-substring-search/README.md +++ b/modules/history-substring-search/README.md @@ -36,6 +36,18 @@ To enable highlighting for this module only, add the following line to zstyle ':prezto:module:history-substring-search' color 'yes' +To set the query found color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:history-substring-search:color' found '' + +To set the query not found color, add the following line to *zpreztorc*: + + zstyle ':prezto:module:history-substring-search:color' not-found '' + +To set the search globbing flags, add the following line to *zpreztorc*: + + zstyle ':prezto:module:history-substring-search' globbing-flags '' + Authors ------- diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh index ea20fff..f6ef84d 100644 --- a/modules/history-substring-search/init.zsh +++ b/modules/history-substring-search/init.zsh @@ -13,11 +13,24 @@ pmodload 'editor' source "${0:h}/external/zsh-history-substring-search.zsh" # -# Styles +# Search # +zstyle -s ':prezto:module:history-substring-search:color' found \ + 'HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND' \ + || HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' + +zstyle -s ':prezto:module:history-substring-search:color' not-found \ + 'HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND' \ + || HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' + +zstyle -s ':prezto:module:history-substring-search' globbing-flags \ + 'HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS' \ + || HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' + if zstyle -t ':prezto:module:history-substring-search' case-sensitive; then - unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS + HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS=\ + "${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS//i}" fi if ! zstyle -t ':prezto:module:history-substring-search' color; then @@ -28,7 +41,7 @@ fi # Key Bindings # -if [[ -n $key_info ]]; then +if [[ -n "$key_info" ]]; then # Emacs bindkey -M emacs "$key_info[Control]P" history-substring-search-up bindkey -M emacs "$key_info[Control]N" history-substring-search-down diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 5494fd9..932edc3 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -58,6 +58,19 @@ zstyle ':prezto:module:editor' keymap 'emacs' # Set the command prefix on non-GNU systems. # zstyle ':prezto:module:gnu-utility' prefix 'g' +# +# History Substring Search +# + +# Set the query found color. +# zstyle ':prezto:module:history-substring-search:color' found '' + +# Set the query not found color. +# zstyle ':prezto:module:history-substring-search:color' not-found '' + +# Set the search globbing flags. +# zstyle ':prezto:module:history-substring-search' globbing-flags '' + # # Pacman #