Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: edit-command-line breaks out of vared
- X-seq: zsh-users 23589
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: edit-command-line breaks out of vared
- Date: Sun, 19 Aug 2018 15:18:37 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wU6Co6461PobH5XoPeWCM0wQbz5dBjkv7VwY99n1/E4=; b=NZSbt9HGAZ1BMWJanogxclJE4fQLEC6YvfrcMVo1gZsRe5HEKmQta8Nqg81+YI+3xY kQdAzObtLKhRM70A51R6Xc8yIdAAce4ncJyHGxPg7K4PNELveZ3kVS4p/BtfqPsbhU/0 wjWGbz7GJJBwVbsQ8SL2uyXClulp2QeAHWwc2CeWrkgKcY276js+yxqu1HqeWgpZxC9K D8TrJ97nHf0EVNuDC4PFW0BewGdMJW7H6v62EGXGwG/pidPhMkPH+eqbhTP0ajhC6P+s KGbQTW65uSabIPzwth98CBx8qjSuGH+4fHlSey5kpkCCeu64In5RSjYrxlaKUPmPXU7d Adhw==
- In-reply-to: <20180819122254.mgx2kfbnbsxxtuqk@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20180819122254.mgx2kfbnbsxxtuqk@tarpaulin.shahaf.local2>
On Sun, Aug 19, 2018 at 2:22 PM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> [[[
> $ zsh -f
> % l=( 1 2 3 )
> % bindkey -e
> % autoload edit-command-line
> % zle -N edit-command-line
> % bindkey '^Fc' edit-command-line
> % vared l
> <press ^F c>
> <:w>
> <:q>
> % 1 2 3<CURSOR>
> ]]]
>
> I expected quitting the editor to let me resume the vared session, but
> instead it left me with the variable's value as a command line.
This works in my version of edit-command-line,
diff --git c/Functions/Zle/edit-command-line w/Functions/Zle/edit-command-line
index e17893e938..761f8da6d0 100644
--- c/Functions/Zle/edit-command-line
+++ w/Functions/Zle/edit-command-line
@@ -29,7 +29,12 @@
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]
# Replace the buffer with the editor output.
- print -Rz - "$(<$1)"
-} =(<<<"$PREBUFFER$BUFFER")
+ # avoid drawing a new prompt when we can
+ [[ -z $PREBUFFER ]] && {
+ BUFFER="$(<$1)"
+ } || {
+ print -Rz - "$(<$1)"
+ zle send-break
+ }
-zle send-break # Force reload from the buffer stack
+} =(<<<"$PREBUFFER$BUFFER")
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author