caa1cc70678e15fe0da93a89e52f543c6bda7494

Author
Suraj N. Kurapati <sunaku@gmail.com>
Committer
Suraj N. Kurapati <sunaku@gmail.com>
Date

Message

zsh-history-substring-search plugin at 15f63de

https://github.com/sunaku/zsh-history-substring-search

Diff

This diff is truncated to protect this page.

  1diff --git a/README b/README
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..be11adf76b54ce2e7f8dc4ad14c61c1c3a62ad28
  4--- /dev/null
  5+++ b/README
  6@@ -0,0 +1,7 @@
  7+To activate this script, load it into an interactive ZSH session:
  8+
  9+  % source history-substring-search.zsh
 10+
 11+See the "history-substring-search.zsh" file for more information:
 12+
 13+  % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more
 14diff --git a/history-substring-search.plugin.zsh b/history-substring-search.plugin.zsh
 15new file mode 100644
 16index 0000000000000000000000000000000000000000..99a5922c5faa3d3130578e119e18a4d7ad6eac55
 17--- /dev/null
 18+++ b/history-substring-search.plugin.zsh
 19@@ -0,0 +1,12 @@
 20+# This file integrates the history-substring-search script into oh-my-zsh.
 21+
 22+source "$ZSH/plugins/history-substring-search/history-substring-search.zsh"
 23+
 24+if test "$CASE_SENSITIVE" = true; then
 25+  unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
 26+fi
 27+
 28+if test "$DISABLE_COLOR" = true; then
 29+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
 30+  unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
 31+fi
 32diff --git a/history-substring-search.zsh b/history-substring-search.zsh
 33new file mode 100644
 34index 0000000000000000000000000000000000000000..53f707c79c11c72931fcae67eeb6931b29cbade0
 35--- /dev/null
 36+++ b/history-substring-search.zsh
 37@@ -0,0 +1,642 @@
 38+#!/usr/bin/env zsh
 39+#
 40+# This is a clean-room implementation of the Fish[1] shell's history search
 41+# feature, where you can type in any part of any previously entered command
 42+# and press the UP and DOWN arrow keys to cycle through the matching commands.
 43+#
 44+#-----------------------------------------------------------------------------
 45+# Usage
 46+#-----------------------------------------------------------------------------
 47+#
 48+# 1. Load this script into your interactive ZSH session:
 49+#
 50+#       % source history-substring-search.zsh
 51+#
 52+#    If you want to use the zsh-syntax-highlighting[6] script along with this
 53+#    script, then make sure that you load it *before* you load this script:
 54+#
 55+#       % source zsh-syntax-highlighting.zsh
 56+#       % source history-substring-search.zsh
 57+#
 58+# 2. Type any part of any previous command and then:
 59+#
 60+#     * Press the UP arrow key to select the nearest command that (1) contains
 61+#       your query and (2) is older than the current command in the command
 62+#       history.
 63+#
 64+#     * Press the DOWN arrow key to select the nearest command that (1)
 65+#       contains your query and (2) is newer than the current command in the
 66+#       command history.
 67+#
 68+#     * Press ^U (the Control and U keys simultaneously) to abort the search.
 69+#
 70+# 3. If a matching command spans more than one line of text, press the LEFT
 71+#    arrow key to move the cursor away from the end of the command, and then:
 72+#
 73+#     * Press the UP arrow key to move the cursor to the line above.  When the
 74+#       cursor reaches the first line of the command, pressing the UP arrow
 75+#       key again will cause this script to perform another search.
 76+#
 77+#     * Press the DOWN arrow key to move the cursor to the line below.  When
 78+#       the cursor reaches the last line of the command, pressing the DOWN
 79+#       arrow key again will cause this script to perform another search.
 80+#
 81+#-----------------------------------------------------------------------------
 82+# Configuration
 83+#-----------------------------------------------------------------------------
 84+#
 85+# This script defines the following global variables. You may override their
 86+# default values only after having loaded this script into your ZSH session.
 87+#
 88+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines
 89+#   how the query should be highlighted inside a matching command. Its default
 90+#   value causes this script to highlight using bold, white text on a magenta
 91+#   background. See the "Character Highlighting" section in the zshzle(1) man
 92+#   page to learn about the kinds of values you may assign to this variable.
 93+#
 94+# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that
 95+#   defines how the query should be highlighted when no commands in the
 96+#   history match it. Its default value causes this script to highlight using
 97+#   bold, white text on a red background. See the "Character Highlighting"
 98+#   section in the zshzle(1) man page to learn about the kinds of values you
 99+#   may assign to this variable.
100+#
101+# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines
102+#   how the command history will be searched for your query. Its default value
103+#   causes this script to perform a case-insensitive search. See the "Globbing
104+#   Flags" section in the zshexpn(1) man page to learn about the kinds of
105+#   values you may assign to this variable.
106+#
107+#-----------------------------------------------------------------------------
108+# History
109+#-----------------------------------------------------------------------------
110+#
111+# This script was originally written by Peter Stephenson[2], who published it
112+# to the ZSH users mailing list (thereby making it public domain) in September
113+# 2009. It was later revised by Guido van Steen and released under the BSD
114+# license (see below) as part of the fizsh[3] project in January 2011.
115+#
116+# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and
117+# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable
118+# ZSH script[5] by Suraj N. Kurapati in 2011.
119+#
120+# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin
121+# Ionescu, and Vincent Guerci in 2011.
122+#
123+# [1]: http://fishshell.com
124+# [2]: http://www.zsh.org/mla/users/2009/msg00818.html
125+# [3]: http://sourceforge.net/projects/fizsh/
126+# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215
127+# [5]: https://github.com/sunaku/zsh-history-substring-search
128+# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting
129+#
130+##############################################################################
131+#
132+# Copyright (c) 2009 Peter Stephenson
133+# Copyright (c) 2011 Guido van Steen
134+# Copyright (c) 2011 Suraj N. Kurapati
135+# Copyright (c) 2011 Sorin Ionescu
136+# Copyright (c) 2011 Vincent Guerci