1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-06 23:31:28 +02:00

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.
This commit is contained in:
Peter Stephenson 2002-03-21 23:03:09 +00:00
parent 25b84ec914
commit 9763da46c8
4 changed files with 45 additions and 0 deletions

View file

@ -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

View file

@ -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))(

View file

@ -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}

View file

@ -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}