# \`rlwrap racket\`

**URL:** <https://racket.discourse.group/t/rlwrap-racket/3084>\
**Category:** General\
**Tags:** repl\
**Created:** [August 12, 2024, 1:09am UTC](https://racket.discourse.group/t/rlwrap-racket/3084 "2024-08-12T01:09:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![not-just-yeti](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/not-just-yeti/32/139_2.png) [@not-just-yeti](https://racket.discourse.group/u/not-just-yeti)\
**Post date:** [August 12, 2024, 1:09am UTC](https://racket.discourse.group/t/rlwrap-racket/3084/1 "2024-08-12T01:09:56Z")

</div>

I've been setting up my `.inputrc` so that I can get vi-keybinding-goodness in various shells/repls. For racket, rlwrap ends up overwriting the "\>" prompt (I can see it momentarily, then it disappears). I ended up faking the prompt with:

```scheme
rlwrap --always-readline --substitute-prompt "> " racket

```

aka `rlwrap -a -S "> " racket`.

I just thought I'd post/archive this solution, in case others run into the same thing. This is on MacOS 14.5, running from `tcsh`.

(And in other, different random quirkiness of `rlwrap`: the python repl shows its prompt fine, but requires a special passing-through of `^D` and even then doesn't see it unless preceded by a space(!?); racket & other shells have no problem with recognizing `^D`.)

---

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [August 12, 2024, 3:02am UTC](https://racket.discourse.group/t/rlwrap-racket/3084/2 "2024-08-12T03:02:24Z")

</div>

At the risk outing myself as someone familiar with neither Vi nor `rlwrap`, some things that might (or might not) be relevant:

- Since Racket 8.4, the default command-line REPL has been based on the Chez Scheme "expression editor", `expeditor`. It provides history and completion features similar to a line-editing library, but it is aware of S-expressions (even mult-line S-expressions), and Racket's version adds the syntax coloring and indentation tools also used by DrRacket. In addition to [many default keybindings](https://docs.racket-lang.org/expeditor/key-bindings.html), it has a [customization API](https://docs.racket-lang.org/expeditor/customization.html) that can do a lot.
- If you _don't_ want to use `expeditor`, you can use the [`,input`](https://docs.racket-lang.org/xrepl/index.html#%28xrepl._input%29) meta-command for `xrepl` to specify what to do instead (taking effect on next start). In particular, `,input readline` selects the Racket [`readline`](https://docs.racket-lang.org/readline/index.html) library, which by default uses libedit.
- If you want to use GNU Readline specifically with Racket's `readline`, either set the environment variable `PLT_READLINE_LIB` to the path to the library, or install the Racket package [`readline-gpl`](https://github.com/racket/readline-gpl) to find it automatically.

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [August 12, 2024, 4:16pm UTC](https://racket.discourse.group/t/rlwrap-racket/3084/3 "2024-08-12T16:16:59Z")

</div>

I started writing a Vi mode for expeditor once, and then decided the primitives didn't quite let me do what I wanted without diving further into internals than I cared to. Despite using Vi modes in most shells (and with Vim as my editor), I've stuck with the default expeditor stuff for now—it's pushed me to do less in the REPL and more in easy-to-run modules and functions 🙂
