Member-only story

Neovim 101— Interactive Code Runner

Evaluate and run code interactively in Neovim.

--

Neovim 101 — Code Runner

This article explores how we can use Neovim as an interactive environment for evaluating code in different languages.

This article is part of the Neovim 101 series.

The Neovim configuration files are available in this repository.

Getting Started

In a previous article, we learned the built-in Vim features to compile and run a program. We also mentioned plugins that help to run code interactively.

In this article, we will explore plugins that help us to evaluate code interactively, from within Neovim.

Conjure

Let’s start with this interesting plugin.

In the Emacs series, we learned how to configure Emacs using Lisp.

Conjure provides an interactive environment for evaluating Lisp code within Neovim.

Besides Lisp-based languages (Clojure, Fennel, Scheme, Common Lisp, Guile, Janet, Hy, Racket, etc.), it supports Rust, Lua, Julia, and Python.

Lisp is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Lisp is the second-oldest high-level programming language still in everyday use.

Let’s try out this plugin with the Fennel language.

We install the following plugins using packer.nvim.

use { "Olical/conjure" }
use { "Olical/aniseed" }

We use Aniseed to bridge the gap between Fennel (a Lisp that gets compiled to Lua) and Neovim.

Now we can evaluate the Fennel code within Neovim.

Conjure — Fennel

For Lua,

--

--

alpha2phi
alpha2phi

Written by alpha2phi

Software engineer, Data Science and ML practitioner.

No responses yet

Write a response