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.p...@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.
>
>
>

Reply via email to