From 46179412eb8aed3968b1ebd7ce170fe09724ef38 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 23 Dec 2012 16:54:43 -0500 Subject: [PATCH] [Fix #52] Add zstyles to configure history-substring-search --- modules/history-substring-search/README.md | 12 ++++++++++++ modules/history-substring-search/init.zsh | 19 ++++++++++++++++--- runcoms/zpreztorc | 13 +++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/modules/history-substring-search/README.md b/modules/history-substring-search/README.md index 6bfe4e6a87..27a4a78f46 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 ea20fffd26..f6ef84dde9 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 5f76a78070..ead57ee8e9 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -67,6 +67,19 @@ zstyle ':prezto:module:editor' dot-expansion 'yes' # 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 #