(Re-posting this message as earlier send appeared to fail; apologies for
any duplication.)

revr...@mweb.co.za writes:
> In sam I can create a script file consisting of a list of edit
> commands to apply to the document. [...] I would like to know if such
> a script would require the regular #!/bin/rc heading, and how it
> would be invoked from within acme.

The paradigm is much the same in acme. As noted earlier, the shebang
just determines which shell the script will run in; you can choose
any shell, or use any executable. You'll just want to make sure that
the script is in your $PATH.

For example, you could create this as $HOME/bin/lstrip:

#! /bin/sh
ssam 'x/^ +?/d'

Make it executable, then write some text in acme:

This is
  some text
    that will be cleaned

If you select this text, type "|lstrip" in the tag (without the quotes),
and Button-2 (middle click) it, you will get the desired effect:

This is
some text
that will be cleaned

To operate on the entire window, type "Edit ,|lstrip" and execute that
with B2. By the way, as for your other example of cleaning whitespace at
the end of a newline (Edit ,x/ +$/d), acme does this by default on Put.

The other way you might approach this is just to keep a text file of
commonly used commands around. Then you can select the command you want,
and mouse-chord B2-B1 on "Edit" in the tag of the desired window to
execute that command.

  - Ben

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Taf408751bc6fb344-Mab8c70f37dc76a709197b202
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to