1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-02 08:51:18 +02:00
zsh/Functions/Zle/up-line-or-beginning-search

19 lines
548 B
Plaintext

# Like up-line-or-search, but uses the whole line prefix up to the
# cursor position for searching backwards.
if [[ $LBUFFER == *$'\n'* ]]; then
zle .up-line-or-history
__searching=''
elif [[ -n $PREBUFFER ]] &&
zstyle -t ':zle:up-line-or-beginning-search' edit-buffer
then
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
fi