Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages

License

NotificationsYou must be signed in to change notification settings

michaelb/sniprun

Repository files navigation

Latest releaseCI buildTotal downloadsLast commit

Introduction

Sniprun is a code runner plugin for neovim written in Lua and Rust. It aims to providestupidly fast partial code testing for most interpretedand compiledlanguage, right from within your favorite editor, blurring the line between standardsave/run workflow, jupyter-like notebook, and REPL/interpreters.


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

Installation, configuration, ...

Seeinstallation instructions,configuration tips,usage explanationsand much more useful information on theWIKI.

spacer

Demos

Send to Sniprun snippets of any language

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

demo_rust2

The result can be returned in multiple (even at the same time) ways:
ClassicVirtual Text/Virtual Line
Temporary Floating WindowTerminal
NotificationAPI
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 (viaevcxr),coming soon for many other interpreted (and compiled) languages.WithREPL-like behavior,you can run code dependent on previously executed code, just like ina REPL !

spacer

Features

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

As a matter of proof, Sniprun :

  • Officially supportsall these languages (compiled & interpreted),and virtuallyany language
  • can create and connect to REPLs in order to present an interactive andplayful 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) theimportsnecessary for your code snippet
  • can runlive(at every keystroke)
  • lends itself to easymappingsand 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 accessesfiles 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 thecurrent 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 beentested on other Unixes (besides Linux itself, of course)

Changelog

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

Contributing

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

About

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    Contributors31

    Languages


    [8]ページ先頭

    ©2009-2025 Movatter.jp