Greg, unfortunately, you cannot rewrite it like that.  You have to put
quotes around (cat $tmp), or each token will end up on its own line in the
command buffer.  (And in fish, you cannot do command substitution inside
quotes.)

Something like
[...]
commandline -r ""
cat $tmp | while read -l cmd; commandline -a "$cmd" ""; end
[...]
would even handle multiple lines as expected.

On Wed, 15 Apr 2015 at 17:20 Greg Reagle <greg.rea...@umbc.edu> wrote:

> On 04/15/2015 11:09 AM, Sanne Wouda wrote:
> > It is possible to implement this with a fish function.
> >
> > function edit_commandline
> >   set -l tmp (mktemp /tmp/fish-fc.XXXXXX)
> >   commandline > $tmp
> >   eval $EDITOR $tmp
> >   cat $tmp | read -l cmd
> >   commandline -r "$cmd"
> >   rm $tmp
> > end
> >
> > Of course, if you do this properly, you'd have to check whether mktemp
> failed, or whether EDITOR is set and executable.
> >
> > To bind this to, for example, Ctrl-x, do
> > $ bind \cx edit_commandline
>
> GREAT!  Fish developers, how about making this function a standard part of
> fish?
>
> I think it could re re-written slightly more concisely:
>
> function edit_commandline
>   set -l tmp (mktemp /tmp/fish-fc.XXXXXX)
>   commandline > $tmp
>   eval $EDITOR $tmp
>   commandline -r (cat $tmp)
>   rm $tmp
> end
>
>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to