1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00
zsh/Functions/Zle/up-line-or-beginning-search
Frank Terbeck e619a7353a 31222: Stop {up,down}-line-or-beginning-search from triggering warn_create_global
This is a followup to 30995 taking Peter's suggestions from 30997 into
account.
2013-04-05 21:05:54 +02:00

22 lines
601 B
Text

# Like up-line-or-search, but uses the whole line prefix up to the
# cursor position for searching backwards.
emulate -L zsh
typeset -g __searching __savecursor
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