-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.teh
46 lines (36 loc) · 1.94 KB
/
.teh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# this is an example Macros file for teh
technically any line that doesn't start with a " get's ignored by the parser so you
don't have to preface comments with a #, you can just type them our plainly like this
but I still like prefacing some comments with a # to indicate a section header because
markdown has permanently altered how I look at plain text documents.
this file is just an example .teh file that I keep in my ~/.config/ (with less comment)
it is easy to modify to your own. If any of your changes don't work, then run
teh --show-macros to see all the macros that are in scope and see any errors when
parsing them
each non-comment line should start with a quoted label, followed by as much whitespce
makes things look clear, then an edit that could also be passed in to teh as an argument.
Remember you can also override the Target anytime you call the macro. for ex. if I
pipe a paragraph of text into `teh par` teh will add a '(' before the first character
of the paragraph, and ')' after the last character. I could still pipe that same
paragraph in to `teh 'each par'` to wrap each line in a '(' and ')', or
`teh 'only 1 3 5 6 par'` to only parenthesize lines 1,3,5,and 6 of the paragraph
# general text editing macros
## little macros that I find useful mostly anywhere
in for indenting lines by one space
"in" Each Ins " " 0
ni for unindenting lines by one space, or delete single line comments
"ni" Each Rem 0 1
trm for un-parenthesizing, or un-block commenting, or just to delete the first and last char
"trm" Whole Rem 0 1 Rem -1 1
"par" Whole Ins "(" 0 Ins ")" -1
"brck" Whole Ins "[" 0 Ins "]" -1
"crly" Whole Ins "{" 0 Ins "}" -1
# language specific comments
## haskell style block and line comments
"hsblk" Whole Ins "{--\n" 0 Ins "\n--}" -1
"hsln" Each Ins "-- " 0
## c style block and line comments
"cblk" Whole Ins "/*\n" 0 Ins "\n*/" -1
"cln" Each Ins "// " 0
## shell comments
"shcmt" Each Ins "# " 0