From 9763da46c81b921cd82c3d145c1777ca5320050e Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 21 Mar 2002 23:03:09 +0000 Subject: 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. --- Functions/Zle/down-line-or-beginning-search | 13 +++++++++++++ Functions/Zle/up-line-or-beginning-search | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Functions/Zle/down-line-or-beginning-search create mode 100644 Functions/Zle/up-line-or-beginning-search (limited to 'Functions') diff --git a/Functions/Zle/down-line-or-beginning-search b/Functions/Zle/down-line-or-beginning-search new file mode 100644 index 000000000..881150171 --- /dev/null +++ b/Functions/Zle/down-line-or-beginning-search @@ -0,0 +1,13 @@ +# Like down-line-or-search, but uses the whole line prefix up to the +# cursor position for searching forwards. + +if [[ $LASTWIDGET != $WIDGET ]] +then + if [[ $LBUFFER == *$'\n'* ]] + then + __last_down_line=down-line-or-history + else + __last_down_line=history-beginning-search-forward + fi +fi +zle .${__last_down_line:-beep} 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} -- cgit 1.4.1