summaryrefslogtreecommitdiff
path: root/plugins/history-substring-search/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/history-substring-search/README.md')
-rw-r--r--plugins/history-substring-search/README.md103
1 files changed, 78 insertions, 25 deletions
diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md
index 6d8b56425..71a389535 100644
--- a/plugins/history-substring-search/README.md
+++ b/plugins/history-substring-search/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):
@@ -33,24 +41,63 @@ Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
2. Activate the plugin in `~/.zshrc`:
- plugins=( [plugins...] history-substring-search)
+ plugins=( [plugins...] zsh-history-substring-search)
+
+3. Run `exec zsh` to take changes into account:
+
+ 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):
-3. Source `~/.zshrc` to take changes into account:
+1. Use the `Oh-my-zsh` Zinit snippet in `~/.zshrc`:
- source ~/.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
@@ -115,7 +166,7 @@ Configuration
------------------------------------------------------------------------------
This script defines the following global variables. You may override their
-default values only after having loaded this script into your ZSH session.
+default values.
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines
how the query should be highlighted inside a matching command. Its default
@@ -141,6 +192,12 @@ default values only after having loaded this script into your ZSH session.
value, causes this script to perform a fuzzy search by words, matching in
given order e.g. `ab c` will match `*ab*c*`
+* `HISTORY_SUBSTRING_SEARCH_PREFIXED` is a global variable that defines how
+ the command history will be searched for your query. If set to a non-empty
+ value, your query will be matched against the start of each history entry.
+ For example, if this variable is empty, `ls` will match `ls -l` and `echo
+ ls`; if it is non-empty, `ls` will only match `ls -l`.
+
* `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines
whether all search results returned are _unique_. If set to a non-empty
value, then only unique search results are presented. This behaviour is off
@@ -155,6 +212,9 @@ default values only after having loaded this script into your ZSH session.
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
------------------------------------------------------------------------------
@@ -175,24 +235,17 @@ History
* March 2016: Geza Lore (@gezalore) greatly refactored it in pull request #55.
-------------------------------------------------------------------------------
-Oh My Zsh Distribution Notes
-------------------------------------------------------------------------------
-
-What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
-as an OMZ module inside the Oh My Zsh distribution.
+---
-The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
-https://github.com/zsh-users/zsh-history-substring-search.
-
-This downstream copy was last updated from the following upstream commit:
+## Oh My Zsh Distribution Notes
- SHA: 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb
- Commit date: 2019-05-12 17:35:54 -0700
+What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search as an OMZ module inside
+the Oh My Zsh distribution.
-Everything above this section is a copy of the original upstream's README, so things
-may differ slightly when you're using this inside OMZ. In particular, you do not
-need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
-plugin does that for you. You may still want to set up additional emacs- or vi-specific
-bindings as mentioned above.
+The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
+https://github.com/zsh-users/zsh-history-substring-search.
+Everything above this section is a copy of the original upstream's README, so things may differ slightly when
+you're using this inside OMZ. In particular, you do not need to set up key bindings for the up and down arrows
+yourself in `~/.zshrc`; the OMZ plugin does that for you. You may still want to set up additional emacs- or
+vi-specific bindings as mentioned above.