Live C++ Coding for Neovim
lila.nvim is a Neovim plugin for real-time, interactive evaluation of C++ code directly in your editor. It connects to the Lila REPL server, an incremental Clang/LLVM JIT compiler, and executes any valid C++20 code with near-zero latency (~1ms, designed for real-time systems).
Lila is MayaFlux's embedded live coding engine: an LLVM 21+ backed C++ JIT interpreter that compiles and executes arbitrary C++ code at runtime with sub-buffer latency. It is designed for exploratory development, algorithmic composition, DSP prototyping, and any workflow where rapid iteration matters.
Lila ships with MayaFlux but accepts any valid C++20 code regardless of whether it uses MayaFlux libraries.
MayaFlux is a unified multimedia DSP architecture treating audio, video, and algorithmic composition as interchangeable computational material. Lila is its live coding interface, usable within MayaFlux projects or standalone for any C++ development.
- Evaluate Line : execute a single line (
<leader>le) - Evaluate Selection : run highlighted code (
<leader>lein visual mode) - Evaluate Buffer : execute your entire file (
<leader>lb) - Evaluate Node : run treesitter-powered semantic code blocks (
<leader>ln) - Eval Highlight : sent code flashes briefly so you always know what was dispatched
- MayaFluxHost : connect directly to a running host process (
<leader>lh) - Auto-Connect : automatically start and connect to the Lila server on plugin load
- Live Output : see compilation results, errors, and execution output in an integrated buffer
- Real-Time Status : monitor connection state at a glance
- Session Persistence : state accumulates across evaluations within a session
Using lazy.nvim:
{
'MayaFlux/lila.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require('lila').setup()
end
}nvim-treesitter is required for evalNode. The other eval commands work without it.
Lila ships as part of MayaFlux. The easiest way to install MayaFlux and get a project set up for live coding is Weave, the MayaFlux installer and project creator.
Install MayaFlux: download and launch Weave from Releases and choose Install MayaFlux. Weave handles the full installation including dependencies and environment setup.
Create a project with live coding: open Weave again, choose Create Project, and check Enable Live Coding (Lila) before creating. This configures your project's CMake to link MayaFlux::MayaFluxHost, enabling the Lila JIT in your process.
1. Open a C++ file
int x = 10;
int y = 20;2. Send code to Lila
Evaluate line by line with <leader>le, or select multiple lines and press <leader>le in visual mode.
3. See results
The "Lila Output" buffer shows successful evaluations, Clang diagnostics on error, and any printed output.
State persists across evaluations within a session:
int counter = 0; -- evaluate oncecounter++;
std::cout << counter << std::endl; -- prints: 1Projects created with live coding enabled link MayaFlux::MayaFluxHost, which embeds the Lila JIT directly in your running process. You can connect lila.nvim to that process instead of a separate lila_server binary.
Press <leader>lh or run :LilaConnectHost and enter host:port. This lets you evaluate code against your live audio/visual state:
#include "MayaFlux/MayaFlux.hpp"
auto sine = vega.Sine(200) | Audio[{0, 1}];
sine->set_frequency(300); // change pitch while the process is running| Command | Binding | Description |
|---|---|---|
LilaEvalLine |
<leader>le |
Evaluate current line |
LilaEvalSelection |
<leader>le (visual) |
Evaluate selection |
LilaEvalBuffer |
<leader>lb |
Evaluate entire buffer |
LilaEvalNode |
<leader>ln |
Evaluate semantic code block |
LilaConnectHost |
<leader>lh |
Connect directly to a MayaFluxHost at host:port |
LilaStartServer |
<leader>ls |
Start Lila server |
LilaStopServer |
<leader>lS |
Stop server |
LilaRestartServer |
<leader>lr |
Restart server |
LilaConnect |
<leader>lc |
Manually connect |
LilaDisconnect |
<leader>ld |
Disconnect from server |
LilaToggleOutput |
<leader>lo |
Toggle output visibility |
LilaClearOutput |
<leader>lx |
Clear output buffer |
LilaStatus |
<leader>li |
Show connection status |
require('lila').setup({
host = "127.0.0.1",
port = 9090,
server_path = "lila_server",
auto_start_server = true,
auto_connect = true,
})If lila_server is not in your PATH, set server_path to the full path.
Verify lila_server is in your PATH:
which lila_serverIf not, set server_path in your config or run the server manually to check for errors:
lila_server -v -l DEBUG- Run
:LilaStatus - Verify
hostis127.0.0.1 - Try a different port if 9090 is in use
- Run
:LilaRestartServer
- Check the Lila Output buffer for errors
- Verify C++20 syntax (Clang reports diagnostics directly)
- Ensure required headers are available
- Try a minimal test:
int x = 42; - Restart the server and reconnect
Issues, feature requests, and contributions welcome on GitHub.
GNU General Public License v3.0. See LICENSE for full terms.
lila.nvim: Live C++ in Neovim. Think in code. Execute in real-time.