Skip to content

MayaFlux/lila.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

lila.nvim

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).

What is Lila?

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.

What is MayaFlux?

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.

Features

  • Evaluate Line : execute a single line (<leader>le)
  • Evaluate Selection : run highlighted code (<leader>le in 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

Installation

lila.nvim

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.

MayaFlux and Lila

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.

Quick Start

Basic Workflow

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 Persistence

State persists across evaluations within a session:

int counter = 0;  -- evaluate once
counter++;
std::cout << counter << std::endl;  -- prints: 1

Connecting to MayaFluxHost

Projects 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

Commands

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

Configuration

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.

Troubleshooting

Server fails to start

Verify lila_server is in your PATH:

which lila_server

If not, set server_path in your config or run the server manually to check for errors:

lila_server -v -l DEBUG

Connection times out

  1. Run :LilaStatus
  2. Verify host is 127.0.0.1
  3. Try a different port if 9090 is in use
  4. Run :LilaRestartServer

Code does not evaluate

  1. Check the Lila Output buffer for errors
  2. Verify C++20 syntax (Clang reports diagnostics directly)
  3. Ensure required headers are available
  4. Try a minimal test: int x = 42;
  5. Restart the server and reconnect

Contributing

Issues, feature requests, and contributions welcome on GitHub.

License

GNU General Public License v3.0. See LICENSE for full terms.


lila.nvim: Live C++ in Neovim. Think in code. Execute in real-time.

About

No description, website, or topics provided.

Resources

License

Stars

5 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages