Skip to content

A REPL in Vim

Published: at 07:00 PM

One of the tools I wish I’d known about sooner is vim-repl. It’s a vim plugin that opens an interactive REPL, configurable based on source file type (.py, .hs, .scala, …)

A REPL, or read-eval-print-loop, lets you input, evaluate, and output expressions without having to (for example) compile an entire program.

I used to run this workflow using SLIME and tmux. Before that, if I wanted a development environment with a tight feedback loop between writing & evaluating code, I defaulted to a Jupyter notebook — which, for this purpose, is probably both the wrong tool to use and often (for me) unsustainable.

I can launch this environment quickly thanks to some keybindings: ,r to open the REPL, and ,w to send code over. Here’s vim-repl in action:

{{< rawhtml >}}

{{< /rawhtml >}}