Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: accept-line question



On Thu, Apr 2, 2015 at 2:50 PM, Dave Yost <Dave@xxxxxxxx> wrote:
> That works.
>
> I do want the executed command to be inserted into history.
>
> I searched the manual in vain for a way to do that. Any chance you could
> illuminate further?

Try this:

--- 8< ---
execute-now() {
  zle -I
  print -S "$BUFFER"
  eval "$BUFFER"
  BUFFER=
  zle -R
}
--- 8< ---

Remaining glitches will be that $? / $pipestatus won't be correct when
redrawing the prompt or executing a subsequent command.  I can't
immediately think of a workaround.



Messages sorted by: Reverse Date, Date, Thread, Author