zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.auc.dk
Subject: edit-command-line widget
Date: Thu, 4 Jan 2001 12:06:04 -0500	[thread overview]
Message-ID: <20010104120604.A23504@dman.com> (raw)

My coworker, who is constantly nagging me about the failings of
zsh's vi-mode, discovered that if he engages the edit-command-line
widget in the midst of a while loop, he will be thrust into $VISUAL
with a single line similar to
'while> echo blah blah blah'

Apparently bash will provide vi the entire loop, changing
newlines to semicolons.  ksh seems to beep stupidly and do nothing.
The useful thing would be to keep the same formatting, which is what
the following widget does.  I'm tempted to replace edit-command-line
with it, but maybe it should remain a separate widget.  Any thoughts?

---8<--snip--8<---

local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$

print -R - "$PREBUFFER$BUFFER" >$tmpfile
exec </dev/tty
${VISUAL:-${EDITOR:-vi}} $tmpfile
zle kill-buffer
BUFFER=${"$(<$tmpfile)"/$PREBUFFER/}
CURSOR=$#BUFFER

command rm -f $tmpfile
zle redisplay


                 reply	other threads:[~2001-01-04 17:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010104120604.A23504@dman.com \
    --to=schizo@debian.org \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).