summary refs log tree commit diff
path: root/Functions/Zle/up-line-or-beginning-search
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-03-21 23:03:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-03-21 23:03:09 +0000
commit9763da46c81b921cd82c3d145c1777ca5320050e (patch)
tree38e3906ca3151c9374c61e88f2b5f8f49208a9f7 /Functions/Zle/up-line-or-beginning-search
parent25b84ec914984bfd9c860e91d3be28b5b0315e6e (diff)
downloadzsh-9763da46c81b921cd82c3d145c1777ca5320050e.tar.gz
zsh-9763da46c81b921cd82c3d145c1777ca5320050e.tar.xz
zsh-9763da46c81b921cd82c3d145c1777ca5320050e.zip
16879: Functions/Zle/up-line-or-beginning-search,
Functions/Zle/down-line-or-beginning-search,
Doc/Zsh/contrib.yo: originally by Bart --- widgets which
combine up-line-or-search and history-beginning-search-backward
behaviour.
Diffstat (limited to 'Functions/Zle/up-line-or-beginning-search')
-rw-r--r--Functions/Zle/up-line-or-beginning-search13
1 files changed, 13 insertions, 0 deletions
diff --git a/Functions/Zle/up-line-or-beginning-search b/Functions/Zle/up-line-or-beginning-search
new file mode 100644
index 000000000..12f2edaae
--- /dev/null
+++ b/Functions/Zle/up-line-or-beginning-search
@@ -0,0 +1,13 @@
+# Like up-line-or-search, but uses the whole line prefix up to the
+# cursor position for searching backwards.
+
+if [[ $LASTWIDGET != $WIDGET ]]
+then
+    if [[ $LBUFFER == *$'\n'* ]]
+    then
+        __last_up_line=up-line-or-history
+    else
+        __last_up_line=history-beginning-search-backward
+    fi
+fi
+zle .${__last_up_line:-beep}