0

Trying to get started with Chicken Scheme I'm finding myself thwarted by the REPL. CSI doesn't seem to allow me to paste multiple lines into it, which makes it really hard to work an a new function in a separate file and then paste it in to test it.

I'm just trying to get a block of code into it in one gulp that was created in an external edit.

The comments to @romainil's answer seem to indicate that some people can. Just not me for reasons I can't fathom.

So, how do I paste multiple lines into csi?

(Side note: I'm doing this on a Mac. I've tried using Terminal and iTerm 2, same results.)

[edit] prior version included side question about how to get a block of code into csi from vim other than pasting. @romainl's answer covered most of that, but short of running a shell within vim I haven't found a solution that actually works.

masukomi
  • 10,313
  • 10
  • 40
  • 49

1 Answers1

1

You probably skipped this part of your REPL's doc: use your editor from your REPL instead of the other way around.

If you insist on doing all that from Vim there are a few additional pointers in this page of the same wiki to which one should probably add Steve Losh's Clam and the many other vim plugins designed to give Vim shell/REPL-like functionalities.

There's also the possibility to set up a custom makeprg and errorformat.

Or, simply:

:!csi %<CR>
romainl
  • 186,200
  • 21
  • 280
  • 313
  • 1) not sure what the docs for `,e` mean by " runs the editor" but it's no normal definition & doesn't support pasting 2) i've already got the additional vim setup from the other page, 3) clam isn't even remotely REPL like & vim's been able to do that for ages w/o his plugin. 4) shelling out to csi ( `:!csi %` ) is useless because state disappears after run. -- I need to be able to interact with a running REPL process, not execute code on the shell. "slimv" is an option for vim but I've never got it to successfully work. – masukomi Aug 06 '14 at 02:08
  • 1) It means that the center of your workflow is the REPL and you use the editor as an extension to edit large blocks of code. 2) Cool, that wasn't immediately obvious from your question. Did you try the alternatives (screen, vimsh and so on)? 3) Clam allows you to evaluate your code and see its result without exiting to the shell. It's not a REPL but it could provide a useful alternative to 4). It would be useful to add a list of attempted solutions to your question so that we don't suggest things that you already tried. – romainl Aug 06 '14 at 07:30
  • But to answer your question more directly, I just installed Chicken and pasted a bunch of multi-line code snippets from their wiki into csi and it worked flawlessly (no error and the expressions where evaluated correctly). There's obviously no direct way for Vim to interact with a running csi but copy/pasting multi-line expressions works perfectly. – romainl Aug 06 '14 at 10:01
  • Thank you for taking the time to try that and "damn", because yes, I've tried screen, hadn't tried vimsh but just installed Conque which is good enough to let me work, so yay (and thanks again), but still leaves the WTF of why I can't paste multiple lines into CSI but someone else can. :/ – masukomi Aug 06 '14 at 11:04