Hi Erik, > I was hacking 'VIP' a bit today, and thought I'd share the results.
Good idea! :) > A new color scheme: > https://gist.github.com/erdg/8d5ad1649975153c963ba7b0a1210fe5 > > And a few normal mode commands for manipulating code comments: > https://gist.github.com/erdg/24e53ad4fcc71d08c88a432c2bcc6544 > > Mostly just a fun way for me to learn more about how the editor / editing > works. Cool! Looks very good! > Is there a recommended way to add new keybindings like this? Right now I'm > editing the definition of 'vi' itself. Currently there are only *F7 through *F12 reserved. For example, my actual ~/.pil/viprc is this: (de *F7 # Find current class definition (evCmd (let L (nth (: buffer text) (: posY)) (loop (NIL (setq L (prior L (: buffer text)))) (T (head '`(chop "(class ") (car L)) (any (pack (car L))) ) ) ) ) ) (de *F8 # Size (evCmd (size (s-expr))) ) (de *F9 # Eval lines till mark "e" (evCmd (run (str (getText (jmpMark "e")))) ) ) (de *F10 # dif (shFile "dif @1 @2 T") ) (de *F11 # cite (goPFore 1 -1) (pipeN (cnt@@) "wrap |sed 's/\^/> /g'") ) (de *F12 # put (shell (rplFile "put %")) ) # 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)) ) We could add more hooks perhaps. But I'm not sure if this is really helpful. > Any plans for 'VipScript'? :P Well, this should be PicoLisp itself ;) > How to access the character under the cursor within the '(case (getch) ..)' > loop? Or get the current line number? I think it should be something like: > > (get (: buffer text) ... (: posY) (: posX) ...) # similar pattern in > other fns This is correct. In the main loop, 'This' is the current window. So for example (case (getch) ("@" (evCmd (get (: buffer text) (: posY) (: posX)))) (... will print the current character into the command window. ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe