$PREBUFFER
–
Line before the current line
$PREBUFFER
contains the contents of the lines before the current line if it’s a multi-line input.
Links
BashSupport Pro is a Zsh IDE with support for $PREBUFFER – try it now!