Discussion:
[Help-bash] use edit-and-execute-command instead the secondary prompt
D630
2017-05-12 08:45:41 UTC
Permalink
How about an option to force bash into invoking
edit-and-execute-command, when
bash wants to use the secondary prompt / needs a second line to complete
the
command?
Eduardo Bustamante
2017-05-12 12:28:49 UTC
Permalink
How about an option to force bash into invoking edit-and-execute-command,
when
bash wants to use the secondary prompt / needs a second line to complete the
command?
Why would you need an option to force it? If you're using the emacs
mode, just hit Ctrl-x Ctrl-e when you get the secondary prompt.
That'll run the edit-and-execute-command function on the partial
input.
Eduardo Bustamante
2017-05-12 12:30:27 UTC
Permalink
On Fri, May 12, 2017 at 7:28 AM, Eduardo Bustamante <***@gmail.com> wrote:
[...]
Post by Eduardo Bustamante
Why would you need an option to force it? If you're using the emacs
mode, just hit Ctrl-x Ctrl-e when you get the secondary prompt.
That'll run the edit-and-execute-command function on the partial
input.
Err, actually... it doesn't seem to work.
Pierre Gaston
2017-05-12 12:32:37 UTC
Permalink
Post by Eduardo Bustamante
How about an option to force bash into invoking edit-and-execute-command,
when
bash wants to use the secondary prompt / needs a second line to complete
the
command?
Why would you need an option to force it? If you're using the emacs
mode, just hit Ctrl-x Ctrl-e when you get the secondary prompt.
That'll run the edit-and-execute-command function on the partial
input.
I guess it would be a kind of automagic feature, as soon as I need to
enter something that doesn't fit on one line, fire up my editor to help me.
D630
2017-05-12 14:10:09 UTC
Permalink
Post by Pierre Gaston
Post by Eduardo Bustamante
How about an option to force bash into invoking edit-and-execute-command,
when
bash wants to use the secondary prompt / needs a second line to complete
the
command?
Why would you need an option to force it? If you're using the emacs
mode, just hit Ctrl-x Ctrl-e when you get the secondary prompt.
That'll run the edit-and-execute-command function on the partial
input.
I guess it would be a kind of automagic feature, as soon as I need to
enter something that doesn't fit on one line, fire up my editor to help me.
Right. Something like:

$ foo | [ENTER] # --> edit-and-execute-command is invoked

$ if foo then [ENTER] # "

$ ls \ [ENTER] # "
Greg Wooledge
2017-05-12 14:19:51 UTC
Permalink
Post by D630
Post by Pierre Gaston
Post by Eduardo Bustamante
How about an option to force bash into invoking edit-and-execute-command,
when
bash wants to use the secondary prompt / needs a second line to complete
the
command?
Why would you need an option to force it? If you're using the emacs
mode, just hit Ctrl-x Ctrl-e when you get the secondary prompt.
That'll run the edit-and-execute-command function on the partial
input.
I guess it would be a kind of automagic feature, as soon as I need to
enter something that doesn't fit on one line, fire up my editor to help me.
$ foo | [ENTER] # --> edit-and-execute-command is invoked
You mean *automatically*?

And then what? What do you want to happen after that? According to
Chet, today, invoking edit-and-execute-command (automatically or not)
when on the second line of a multi-line command will NOT allow you to
edit a multi-line command safely. And apparently this is not going to
change, because it's "meant to work like that".

https://lists.gnu.org/archive/html/bug-bash/2017-05/msg00113.html

You need to hit ESC v (or whatever) while you are on the FIRST line,
apparently.
D630
2017-05-13 12:00:53 UTC
Permalink
Post by Greg Wooledge
Post by D630
Post by Pierre Gaston
Post by Eduardo Bustamante
How about an option to force bash into invoking edit-and-execute-command,
when
bash wants to use the secondary prompt / needs a second line to complete
the
command?
Why would you need an option to force it? If you're using the emacs
mode, just hit Ctrl-x Ctrl-e when you get the secondary prompt.
That'll run the edit-and-execute-command function on the partial
input.
I guess it would be a kind of automagic feature, as soon as I need to
enter something that doesn't fit on one line, fire up my editor to help me.
$ foo | [ENTER] # --> edit-and-execute-command is invoked
You mean *automatically*?
And then what? What do you want to happen after that? According to
Chet, today, invoking edit-and-execute-command (automatically or not)
when on the second line of a multi-line command will NOT allow you to
edit a multi-line command safely. And apparently this is not going to
change, because it's "meant to work like that".
https://lists.gnu.org/archive/html/bug-bash/2017-05/msg00113.html
You need to hit ESC v (or whatever) while you are on the FIRST line,
apparently.
Ja, I mean *automatically*, a kind of
https://gist.github.com/D630/fcb48ccb2940b2818ced1883cf0d4dc8, but
built-in, save, faster etc. pp.

Loading...