-
Notifications
You must be signed in to change notification settings - Fork 151
Using Readline with REPLs for Better Editing
By default, the REPLs provided by the lein-cljsbuild REPL commands only have very basic command-line editing support, and are rather painful to use. However, if you have rlwrap installed (on Ubuntu or Mac you can use apt-get or brew to install it), you can enable rich command-line editing by running something like this (note that these examples were written using rlwrap version 0.37):
rlwrap -r -m -q '\\"' -b "(){}[],^%3@\\\";:'" lein trampoline cljsbuild <repl-command>
(Note that on Mac OS, you may have to omit the -q). To avoid the tediousness of pasting the above command each time you wish to start a REPL, you might want to add a simple wrapper script to your $PATH
. I put this script in ~/bin/cljs-repl
. Don't forget to make it executable!
#!/bin/bash
rlwrap -r -m -q '\\"' -b "(){}[],^%3@\\\";:'" lein trampoline cljsbuild repl-$1
Now you can run cljs-repl rhino
, cljs-repl listen
, etc, and have full readline support.
#!/bin/bash
rlwrap lein trampoline cljsbuild repl-$1