From: "Peter A. Cejchan" <tyapca7@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Acme Edit scriptlets
Date: Fri, 29 Mar 2013 09:22:25 +0100 [thread overview]
Message-ID: <CAM6ozu4BMKH+XSvBwTFZD_aCg0CkiqKG=UdksxS4oKij2L4UCw@mail.gmail.com> (raw)
In-Reply-To: <de09648c46b1871990b74959abc602ab@9sys.net>
[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]
Thanks, very nice, mates!
I humbly add some of minebelow.
Best, ++pac
#####
## Latin
äëïñöüÿÄÅËÏÖÜ
## Greek
αβγδεζηθλμνξπρστφψωΓΔΘΛΞΠΣΦΨΩ
## select text
:; # select all text
:;25 # select from start to line 25 (inclusive)
:25; # select from line 25 (inclusive) to EOF
Edit /;[ ]*\/\// # select from ; to // comments
## edit text
Edit s/^/ /g # increase indentation
Edit s,^ ,,g # decrease indentation
Edit s/^/\/\/ /g #comment out using //
Edit s/\n\n\n+/\n\n/g # remove redundant newlines, keep max two
Edit s/^[ ]+//g # remove leading whitespace
Edit s/[ ]+$//g # remove trailing whitespace
Edit s/ +/ /g # remove multiple spaces
Edit s/;$//g # remove trailing semicolon
Edit s/\*+\///g # comments
Edit s/\/\*+/\/\//g
Edit s/[\(\)]/ /g # remove ()
Edit s/.*/(&)/g # add ()
Edit s/.*/float64(&)/g # float64()
Edit s/.*/} & {/g # add } {
Edit s/^/\/\/ /g # // comment out
Edit /;[ ]*\/\// Edit s/;// # find and remove semicolon before //
comments
Edit s/\+\+[a-zA-Z]+[0-9a-zA-Z]*/&++/ Edit s/\+\+/d # NOT WORKING prefix
to postfix operator
Edit s/->/./g # struct pointer
Edit ,s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/g# prefix to postfix operator: ++
Edit ,s/\-\-([A-Za-z]+[A-Za-z0-9]*)/\1--/g# prefix to postfix operator: --
# prefix to postfix operator: ++i --> i++
Edit /\+\+[a-zA-Z_]+[0-9a-zA-Z_]*/{
x/\+\+/d
a/++/
}
Edit s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/ # prefix to postfix operator: ++i
--> i++
| 9 sed 's/\(//; s/(.*)\)/\1/' # remove outermost pair of parentheses
Edit s:\((.*)\):\1:g # remove outermost pair of parentheses
On Fri, Mar 29, 2013 at 2:19 AM, <phineas.pett@gmail.com> wrote:
> > Hi!
> >
> > I did a quick writeup on little Edit scripts
> > (well basicly sam(1) scripts)
> > If anyone have more feel free to contribute.
> > Maybe someone could put them on the wiki even.
>
> Nice idea...
>
> Here's a simple awk bit I use in Acme for centering text (its name is
> the center-line rune: ℄)
>
> #!/bin/rc
> # Center text
> awk '{l=length();s=int((70-l)/2); printf "%"(s+l)"s\n",$0}'
>
> It doesn't seem to be common practice, but I like to name editing
> commands with unicode runes to save room: i.e. ← and → for
> indentation (used with code), or ⇐ and ⇒ for indentation + a reformat
> (used for natural language next). I find they serve a bit like icons.
>
>
>
[-- Attachment #2: Type: text/html, Size: 3231 bytes --]
next prev parent reply other threads:[~2013-03-29 8:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-29 0:38 Bence Fábián
2013-03-29 1:19 ` phineas.pett
2013-03-29 8:22 ` Peter A. Cejchan [this message]
2013-03-29 8:20 ` dexen deVries
2013-03-29 8:25 ` Peter A. Cejchan
2013-03-29 8:48 ` dexen deVries
2013-03-29 9:50 ` Richard Miller
2013-03-29 16:20 ` Skip Tavakkolian
2013-04-04 10:19 ` Mark van Atten
2013-04-04 12:08 ` dexen deVries
2013-04-04 12:16 ` Bence Fábián
2013-04-04 12:28 ` erik quanstrom
2013-04-04 13:01 ` Bence Fábián
2013-04-04 13:04 ` [9fans] Acme script request (was: Acme Edit scriptlets) dexen deVries
2013-04-04 13:17 ` Bence Fábián
2013-04-05 12:35 ` Martin Kühl
2013-04-05 12:50 ` dexen deVries
2013-04-05 12:32 ` [9fans] Acme Edit scriptlets David Arroyo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM6ozu4BMKH+XSvBwTFZD_aCg0CkiqKG=UdksxS4oKij2L4UCw@mail.gmail.com' \
--to=tyapca7@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).