16 Commits
Author SHA1 Message Date
Brian MoeskauandKoston-0xDEADBEEF a0bdb0d47d Fix zplug syntax
The space before "plugin" raises an error
2026-09-18 10:11:24 +03:00
chrisgarberandKoston-0xDEADBEEF 349f731e32 Update README.md
remove trailing `
2026-09-17 18:45:45 +03:00
Suraj N. KurapatiandGitHub 14c8d2e0ff Merge pull request #175 from cxwx/patch-1
Update README.md to fix forgotten single quote mark.
2026-01-15 09:44:55 -08:00
chenxuandGitHub aa09f04747 Update README.md 2025-12-05 09:45:47 +08:00
Guido van SteenandGitHub 87ce96b186 Merge pull request #159 from dxrcy/master
Fix user input after search
2024-06-05 07:04:53 +02:00
darcy 3235b885dd Fix user input after search, including space key 2024-02-16 12:27:31 +11:00
darcy 837d49959e Fix user input after search
Now when a user types `-` directly after searching, it is not treated as a commandline option by `zle`
2024-01-26 11:26:14 +11:00
Arjun Reddy KandKoston-0xDEADBEEF 8dd05bfcc1 Update README.md
Remove percent sign (%). The source command should not be prefixed with % symbol.
2023-11-23 12:12:14 +02:00
8f5d8a5aa9 Add Fig as an installation method to the README (#133)
* Add Fig as an installation method to the README

---------

Co-authored-by: Ilkin Bayramli <43158991+ibayramli2001@users.noreply.github.com>
2023-11-21 19:54:14 +02:00
Atte Peltomäki 4f982d65b4 Merge branch 'zinit-readme'
Resolved merge conflict.
2023-11-21 19:45:43 +02:00
PadsworthandAtte Peltomäki a7e6d94ba5 updated readme to include Zinit instructions 2023-11-21 19:24:11 +02:00
Andy RichardsonandKoston-0xDEADBEEF 19b887667a Use brew to determine prefix
https://docs.brew.sh/FAQ#why-should-i-install-homebrew-in-the-default-location
2023-11-08 13:33:12 +02:00
Chris HuaandKoston-0xDEADBEEF 2e28e23261 fix: line wrap 2023-11-08 12:14:56 +02:00
Chris HuaandKoston-0xDEADBEEF 591ca3326a chore: update readme
- adds example for `zplug`
- adds example for `antigen` - closes #113
- adds note for alternative binding keys - clsoes #141, $138
2023-11-08 12:14:56 +02:00
kooshieandKoston-0xDEADBEEF 3bbc5a8cfa replace sourcing method with exec zsh 2023-11-08 11:45:46 +02:00
Atte PeltomäkiandKoston-0xDEADBEEF da5f0673b9 fix search match highlight with latest z-sy-h
Search highlight is cleared after a timeout, which is one second by default.
Timeout period can be changed by setting an environment variable; example below
for setting one minute timeout.

  HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT=60

Fixes #131
2023-11-08 11:36:37 +02:00
2 changed files with 78 additions and 7 deletions
+60 -6
View File
@@ -23,7 +23,15 @@ Install
Using the [Homebrew]( https://brew.sh ) package manager:
brew install zsh-history-substring-search
echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
echo 'source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
Using [Fig](https://fig.io):
Fig adds apps, shortcuts, and autocomplete to your existing terminal.
Install `zsh-history-substring-search` in just one click.
<a href="https://fig.io/plugins/other/zsh-history-substring-search" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" /></a>
Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
@@ -35,22 +43,61 @@ Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
plugins=( [plugins...] zsh-history-substring-search)
3. Source `~/.zshrc` to take changes into account:
3. Run `exec zsh` to take changes into account:
source ~/.zshrc
exec zsh
Using [zplug](https://github.com/zplug/zplug):
1. Add this repo to `~/.zshrc`:
zplug "zsh-users/zsh-history-substring-search", as:plugin
Using [antigen](https://github.com/zsh-users/antigen):
1. Add the `antigen bundle` command just before `antigen apply`, like this:
```
antigen bundle zsh-users/zsh-history-substring-search
antigen apply
```
2. Then, **after** `antigen apply`, add the key binding configurations, like this:
```
# zsh-history-substring-search configuration
bindkey '^[[A' history-substring-search-up # or '\eOA'
bindkey '^[[B' history-substring-search-down # or '\eOB'
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
```
Using [Zinit](https://github.com/zdharma-continuum/zinit):
1. Use the `Oh-my-zsh` Zinit snippet in `~/.zshrc`:
zinit snippet OMZ::plugins/git/git.plugin.zsh
2. Load the plugin in `~/.zshrc`:
zinit load 'zsh-users/zsh-history-substring-search'
zinit ice wait atload'_history_substring_search_config'
3. Run `exec zsh` to take changes into account:
exec zsh
Usage
------------------------------------------------------------------------------
1. Load this script into your interactive ZSH session:
% source zsh-history-substring-search.zsh
source zsh-history-substring-search.zsh
If you want to use [zsh-syntax-highlighting][6] along with this script,
then make sure that you load it *before* you load this script:
% source zsh-syntax-highlighting.zsh
% source zsh-history-substring-search.zsh
source zsh-syntax-highlighting.zsh
source zsh-history-substring-search.zsh
2. Bind keyboard shortcuts to this script's functions.
@@ -73,6 +120,10 @@ Usage
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
Users have also observed that `[OA` and `[OB` are correct values,
_even if_ these were not the observed values. If you are having trouble
with the observed values, give these a try.
You might also want to bind the Control-P/N keys for use in EMACS mode:
bindkey -M emacs '^P' history-substring-search-up
@@ -161,6 +212,9 @@ default values.
receive globally unique search results only once, then use this
configuration variable, or use `setopt HIST_IGNORE_ALL_DUPS`.
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT` is a global variable that
defines a timeout in seconds for clearing the search highlight.
History
------------------------------------------------------------------------------
+18 -1
View File
@@ -406,7 +406,24 @@ _history-substring-search-end() {
# For debugging purposes:
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
# read -k -t 200 && zle -U $REPLY
# read -k -t 200 && zle -U -- "$REPLY"
#
# When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
# logic for determining highlight priority, when two different memo= marked
# region highlights overlap; instead, it always prioritises itself. Below is
# a workaround for dealing with it.
#
if [[ $_history_substring_search_zsh_5_9 -eq 1 ]]; then
zle -R
#
# After line redraw with desired highlight, wait for timeout or user input
# before removing search highlight and exiting. This ensures no highlights
# are left lingering after search is finished.
#
read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U -- "$REPLY"
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
fi
# Exit successfully from the history-substring-search-* widgets.
return 0