2002-03-22 00:03:09 +01:00
|
|
|
# Like up-line-or-search, but uses the whole line prefix up to the
|
|
|
|
# cursor position for searching backwards.
|
|
|
|
|
2007-08-21 19:35:55 +02:00
|
|
|
emulate -L zsh
|
|
|
|
|
2002-04-04 13:59:08 +02:00
|
|
|
if [[ $LBUFFER == *$'\n'* ]]; then
|
|
|
|
zle .up-line-or-history
|
|
|
|
__searching=''
|
|
|
|
elif [[ -n $PREBUFFER ]] &&
|
|
|
|
zstyle -t ':zle:up-line-or-beginning-search' edit-buffer
|
2002-03-22 00:03:09 +01:00
|
|
|
then
|
2002-04-04 13:59:08 +02:00
|
|
|
zle .push-line-or-edit
|
|
|
|
else
|
|
|
|
[[ $LASTWIDGET = $__searching ]] && CURSOR=$__savecursor
|
|
|
|
__savecursor=$CURSOR
|
|
|
|
__searching=$WIDGET
|
|
|
|
zle .history-beginning-search-backward
|
|
|
|
zstyle -T ':zle:up-line-or-beginning-search' leave-cursor &&
|
|
|
|
zle .end-of-line
|
2002-03-22 00:03:09 +01:00
|
|
|
fi
|