Arc Forumnew | comments | leaders | submitlogin
Ask AL: pprint + vim
1 point by antiismist 6047 days ago | 8 comments
Anyone figure out how to use pprint.arc from within VIM? I'm trying to highlight some text in VIM, and execute a command to get it replaced with pretty printed code. Haven't quite got it figured out yet. Thanks!


2 points by almkglor 6047 days ago | link

It should be possible, in theory, to create a wrapper script that executes the arc code, but the problems are:

1. Arc-on-mzscheme startup time is slow

2. Arc-on-mzscheme doesn't support properly launching from any directory other than the installation directory.

If the above problems are fixed (or if problem 2 is fixed and you don't find problem 1 too much of a problem) we could simply use shift-V, select range, then shift-1 and type the script name.

-----

1 point by antiismist 6045 days ago | link

Is there any way to shoot the text over to an already running interpreter and capture the output (to delay startup times..)?

-----

2 points by almkglor 6045 days ago | link

Possibly some mkfifo hackery in Linux?

Possibly do something stupid like:

  mkfifo to_arc
  mkfifo from_arc
  ./arc.sh < to_arc > from_arc
Then just pipe commands through the to_arc and from_arc FIFO's? (this is untested)

Edit: Alternatively, you might want to do this in a thread on an existing arc session, again still using mkfifo hackery:

  (w/infile i "to_arc"
    (w/outfile o "from_arc"
      (w/uniq invalid
        (def foo ()
          (let ip (read i invalid)
            (if (isnt ip invalid)
                (write (eval ip) o)))
          (foo)))))
  (thread (foo))

-----

1 point by jmatt 6047 days ago | link

ESC :q

emacs

Oh so entertaining to see AL get questions directed to him in the same style as PG.

PG must be getting married. He's been gone long enough for someone to take over leadership of these forums.

-----

3 points by antiismist 6047 days ago | link

AL was supposed to be Arc Language, but good point on almkglor too.

-----

2 points by PieSquared 6046 days ago | link

Not the first time: http://arclanguage.org/item?id=6889

Congrats to him on becoming mini-leader of Arc!

-----

1 point by almkglor 6047 days ago | link

AL == arclanguage? Who's AL?

-----

1 point by applepie 6047 days ago | link

You've obviously taken the lead!

-----