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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
# 21dec25 Software Lab. Alexander Burger
# Copy to ~/.pil/viprc
## Uncomment to enable the ":cal" (calendar) command
## (load "@lib/vip/cal.rc.l")
(map+q "d" ":bd\r")
## If you prefer LEFT and RIGHT to move the cursor:
## (map+ "\e[D" "h")
## (map+ "\e[C" "l")
(cmd "pb1n" (L Lst Cnt) # Pastebin
(pipe
(out '("curl" "-F" "f=@-;" "pb1n.de")
(mapc prinl (: buffer text)) )
(prCmd (rdLines)) ) )
(cmd "ix.io" (L Lst Cnt)
(pipe
(out '("curl" "-sF" "f:1=<-" "ix.io")
(mapc prinl (: buffer text)) )
(prCmd (rdLines)) ) )
(cmd "tabs" (L Lst Cnt)
(let N (or (format L) 3)
(=: buffer text
(mapcar
'((L)
(make
(for (I . C) L
(if (= "\t" C)
(loop
(link (name " "))
(T (=0 (% I N)))
(inc 'I) )
(link C) ) ) ) )
(: buffer text) ) ) ) )
(cmd "words" (L Lst Cnt)
(xchg 'delimNs
(quote
((C)
(nand C
(sub? C
"0123456789\
ABCDEFGHIJKLMNOPQRSTUVWXYZ\
_\
abcdefghijklmnopqrstuvwxyz" ) ) ) ) )
(prCmd
(list (chop (xchg '(" C") '(" Lisp")))) ) )
(de *F7 # Find current definition
(let L (nth (: buffer text) (: posY))
(prCmd
(list
(loop
(NIL (setq L (prior L (: buffer text))))
(T (head '`(chop "(class ") (car L))
(car L) )
(T (head '`(chop "(extend ") (car L))
(car L) ) ) ) ) ) )
(de *F8 # Expression size
(evCmd (size (s-expr))) )
# Timestamp
(local) vipDat
(de vipDat (N)
(when (<> N (: posY))
(let (@L (get (: text) N) @A)
(and
(match '(@A " " @L) @L)
(member @A '(("#") ("/" "/") ("/" "*")))
(>= 31 (format (cut 2 '@L)) 1)
(member (pack (cut 3 '@L)) *mon)
(format (cut 2 '@L))
(mapc set
(set (nth (: text) N)
(conc
@A
(list (char 32))
(chop (datSym (date)))
@L ) )
1 ) ) ) ) )
(daemon '(save> . +Buffer)
(or (vipDat 1) (vipDat 2) (vipDat 3)) )
# Local
(and (info ".viprc") (load ".viprc"))
|