Skip to content

Commit

Permalink
[Fix sorin-ionescu#52] Add zstyles to configure history-substring-search
Browse files Browse the repository at this point in the history
  • Loading branch information
sorin-ionescu authored and matthoffman committed Sep 18, 2014
1 parent 500a207 commit 4617941
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
12 changes: 12 additions & 0 deletions modules/history-substring-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------

Expand Down
19 changes: 16 additions & 3 deletions modules/history-substring-search/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions runcoms/zpreztorc
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit 4617941

Please sign in to comment.