Skip to content

Commit

Permalink
history-substring-search: Tweak documentation and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
indrajitr committed Sep 12, 2023
1 parent 74a19fb commit 5ac930d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
26 changes: 19 additions & 7 deletions modules/history-substring-search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,42 @@ _`${ZDOTDIR:-$HOME}/.zpreztorc`_:

```sh
zstyle ':prezto:module:history-substring-search' globbing-flags ''
```

### Case sensitive search

To set the search matched against the start of each history entry, add the following line to
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'
```

### 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
Expand Down
10 changes: 5 additions & 5 deletions modules/history-substring-search/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
#
Expand Down
11 changes: 7 additions & 4 deletions runcoms/zpreztorc
Original file line number Diff line number Diff line change
Expand Up @@ -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'

#
Expand Down

0 comments on commit 5ac930d

Please # to comment.