[Fix #52] Add zstyles to configure history-substring-search

This commit is contained in:
Sorin Ionescu 2012-12-23 16:54:43 -05:00
parent 810a4490d7
commit 6cd97d2d0f
3 changed files with 41 additions and 3 deletions

View file

@ -36,6 +36,18 @@ To enable highlighting for this module only, add the following line to
zstyle ':prezto:module:history-substring-search' color 'yes' 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 Authors
------- -------

View file

@ -13,11 +13,24 @@ pmodload 'editor'
source "${0:h}/external/zsh-history-substring-search.zsh" 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 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 fi
if ! zstyle -t ':prezto:module:history-substring-search' color; then if ! zstyle -t ':prezto:module:history-substring-search' color; then
@ -28,7 +41,7 @@ fi
# Key Bindings # Key Bindings
# #
if [[ -n $key_info ]]; then if [[ -n "$key_info" ]]; then
# Emacs # Emacs
bindkey -M emacs "$key_info[Control]P" history-substring-search-up bindkey -M emacs "$key_info[Control]P" history-substring-search-up
bindkey -M emacs "$key_info[Control]N" history-substring-search-down bindkey -M emacs "$key_info[Control]N" history-substring-search-down

View file

@ -58,6 +58,19 @@ zstyle ':prezto:module:editor' keymap 'emacs'
# Set the command prefix on non-GNU systems. # Set the command prefix on non-GNU systems.
# zstyle ':prezto:module:gnu-utility' prefix 'g' # 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 # Pacman
# #