diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2002-03-21 23:03:09 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2002-03-21 23:03:09 +0000 |
commit | 9763da46c81b921cd82c3d145c1777ca5320050e (patch) | |
tree | 38e3906ca3151c9374c61e88f2b5f8f49208a9f7 | |
parent | 25b84ec914984bfd9c860e91d3be28b5b0315e6e (diff) | |
download | zsh-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.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | Doc/Zsh/contrib.yo | 11 | ||||
-rw-r--r-- | Functions/Zle/down-line-or-beginning-search | 13 | ||||
-rw-r--r-- | Functions/Zle/up-line-or-beginning-search | 13 |
4 files changed, 45 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index defbbaeaa..e1616fbbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-03-21 Peter Stephenson <pws@csr.com> + + * 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. + 2002-03-19 Oliver Kiddle <opk@zsh.org> * 16864: Completion/Unix/Command/ssh: fix remote file completion diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 21997b7d8..f21a31284 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -430,6 +430,17 @@ zle -N history-beginning-search-forward-end \ bindkey '\e^P' history-beginning-search-backward-end bindkey '\e^N' history-beginning-search-forward-end) ) +tindex(up-line-or-beginning-search) +tindex(down-line-or-beginning-search) +item(tt(up-line-or-beginning-search), tt(down-line-or-beginning-search))( +These widgets are similar to the builtin functions tt(up-line-or-search) +and tt(down-line-or-search): if in a multiline buffer they move up or +down within the buffer, otherwise they search for a history line matching +the start of the current line. In this case, however, they search for +a line which matches the current line up to the current cursor position, in +the manner of tt(history-begining-search-backward) and tt(-forward), rather +than the first word on the line. +) tindex(incarg) vindex(incarg, use of) item(tt(incarg))( 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} |