Compare commits
10 commits
2e28e23261
...
14c8d2e0ff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c8d2e0ff | ||
|
|
aa09f04747 | ||
|
|
87ce96b186 | ||
|
|
3235b885dd | ||
|
|
837d49959e | ||
|
|
8dd05bfcc1 | ||
|
|
8f5d8a5aa9 | ||
|
|
4f982d65b4 | ||
|
|
a7e6d94ba5 | ||
|
|
19b887667a |
2 changed files with 29 additions and 6 deletions
31
README.md
31
README.md
|
|
@ -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):
|
||||
|
||||
|
|
@ -63,18 +71,33 @@ 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ _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
|
||||
|
|
@ -421,7 +421,7 @@ _history-substring-search-end() {
|
|||
# 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
|
||||
read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U -- "$REPLY"
|
||||
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue