Re:Improve your REPLs with rlwrap
by stinkypete on Sunday January 20, 2013 @06:59PM
(#5088865)
You might try starting rlwrap with the `-m' option (--multi-line) which by default escapes " \ " into newlines. By itself this isn't all that useful but this enables editing the line in your $EDITOR via `ctrl-^'. When you do this the editor will display the escape sequences as literal newlines, so that means you can do multi-line editing with up to recall a previous expression and `ctrl-^' to edit it.
If you're to the point where you are editing lots of multiline expressions you may want to consider using an editor that has a function that will send the contents of a buffer or the current expression to a running interpreter. Emacs is an obvious choice for this, but there are lots of plugins to other editors/IDEs that do the same.
For example, when using a clojure repl and entering a multiline expression, I might err on one line and want to go back and correct that line before evaluating the expression. Unfortunately, the only option I have right now is to terminate that expression by entering in a bunch of closing parens and then trying to enter in the entire multiline expression again. It'd be great if multiline expressions could be modifiable and if you could up arrow to load a previous multiline expression.