zsh-workers
 help / color / mirror / code / Atom feed
* edit-command-line widget
@ 2001-01-04 17:06 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2001-01-04 17:06 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-01-04 17:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-04 17:06 edit-command-line widget Clint Adams

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).