A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
  • Rust 93%
  • Lua 4.6%
  • Shell 1.8%
  • Python 0.5%
Find a file
2026-04-04 19:34:41 +02:00
.github upgrade uv stuff to hopefully disable zizmor warning 2025-12-09 20:27:23 +01:00
autoload/health checkhealt in lua 2021-03-29 21:45:10 +02:00
doc max fw width 2026-02-23 19:45:38 +01:00
lua Merge pull request #328 from michaelb/dev 2026-02-26 21:34:26 +01:00
plugin full backwoard compatibility 2021-03-28 15:25:42 +02:00
ressources update readme, rust demo gif 2025-10-11 19:26:09 +02:00
src rm uneeded stuff 2025-12-30 12:16:32 +01:00
tests rework module tree for better LSP integration 2024-07-22 23:02:38 +02:00
.codecov.yml fix (&loosen) codecov 2022-05-26 17:25:38 +02:00
.editorconfig update editor config end_of_line stuff 2025-02-10 20:25:33 +01:00
.gitignore no ignore + original cargo.lock 2023-10-06 19:13:44 +02:00
.gitmodules removed submodule 2020-09-17 09:55:07 +02:00
API.md docs: fix typos 2024-10-11 17:01:22 +02:00
build.rs rework module tree for better LSP integration 2024-07-22 23:02:38 +02:00
Cargo.lock pin proc-macro, log, quote ryu, unicode-ident to specific version (MSRV) 2026-02-26 21:26:12 +01:00
Cargo.toml update to new version 2026-02-26 19:17:00 +01:00
CHANGELOG.md update to new version 2026-02-26 19:17:00 +01:00
CHECKLIST.md pin proc-macro, log, quote ryu, unicode-ident to specific version (MSRV) 2026-02-26 21:26:12 +01:00
CONTRIBUTING.md docs: fix typos 2024-10-11 17:01:22 +02:00
install.sh fix: correct string comparison operator for compatibility with sh 2024-07-22 22:47:58 +02:00
LICENSE Create LICENSE 2021-01-24 10:59:58 +01:00
README.md update README 2026-04-04 19:34:41 +02:00

Introduction

Sniprun is a code runner plugin for neovim written in Lua and Rust. It aims to provide stupidly fast partial code testing for most interpreted and compiled language , right from within your favorite editor, blurring the line between standard save/run workflow, jupyter-like notebook, and REPL/interpreters.


TLDR: { "michaelb/sniprun", "build = "sh install.sh" }, :SnipRun, :'<,'>SnipRun, :SnipInfo

Installation, configuration, ...

See installation instructions , configuration tips , usage explanations and much more useful information on the WIKI.

spacer

Demos

Send to Sniprun snippets of any language

A very simple example (Rust, of course), where current lines and visual selections are sent to sniprun via shortcuts.

demo_rust2

The result can be returned in multiple (even at the same time) ways:
Classic Virtual Text/Virtual Line
Temporary Floating Window Terminal
Notification API
REPL-like behavior is available for some languages

Python, Julia, Lua, JavaScript & Typescript (via deno), Clojure, R, Mathematica, Sage, PHP, Swift, OCaml, and of course Rust (via evcxr), coming soon for many other interpreted (and compiled) languages. With REPL-like behavior ,you can run code dependent on previously executed code, just like in a REPL !

spacer

Features

Sniprun is a way to quickly run small snippets of code, on the fly, and iterate very quickly and conveniently. To learn a language, to quickly experiment with new features (not yet embedded in classes or a whole project etc...), or to develop simple code pipelines (like a machine learning exercise) that fit in a unique file, sniprun is probably the best plugin out there.

As a matter of proof, Sniprun :

  • Officially supports all these languages (compiled & interpreted), and virtually any language
  • can create and connect to REPLs in order to present an interactive and playful interface
  • can run things like GUI plots, networks requests or even Ansible playbooks
  • doesn't require even one line of configuration by default (but can be customized up to the tiniest things)
  • can run code from a part of a file which isn't complete / contains errors
  • can automatically fetch (in some languages) the imports necessary for your code snippet
  • can run live (at every keystroke)
  • lends itself to easy mappings and Vim motions
  • has an API (for running code, and displaying results)
  • has many result display modes that can be enabled at the same time, and for different output status if wanted
  • supports literate programming in Markdown, Orgmode and Neorg

Known limitations

Due to its nature, Sniprun may have trouble with programs that :

  • Mess with standard output / stderr
  • Need to read from stdin
  • Access files; sniprun does not run in a virtual environment, it accesses files just like your own code do, but since it does not run the whole program , something might go wrong. Relative paths may cause issues, as the current working directory for sniprun will be somewhere in ~/.cache/sniprun, and relative imports may miss.
  • No support for Windows
  • NixOS, MacOS users have to compile sniprun locally. Sniprun has not been tested on other Unixes (besides Linux itself, of course)

Changelog

It's been quite a journey already! For history fans, see the full changelog.

Contributing

Sniprun should be quite contributor-friendly (see CONTRIBUTING.md), so it's relatively easy to create / fix interpreters for any language. But any (constructive) issue, discussion, or documentation Pull Request is a welcome form of contribution !

AI: agents and users, don't bother. See my stance here