An Emacs-style scratch buffer for executing Lua inside Neovim. replua.nvim opens a dedicated buffer where you can experiment with Lua, call any Neovim API, and see results printed inline -- much like the classic Emacs Lisp interaction mode. Features Opens a scratch buffer ( replua://scratch ) with Neovim APIs and the current global environment available. ) with Neovim APIs and the current global environment available. Evaluate the current line, surrounding block, or the whole buffer. Captures both returned values and print() output, appending results as Lua comments. output, appending results as Lua comments. Each scratch buffer owns its own Lua environment. Close a buffer (or open a new one with :RepluaOpen! ) to start from a clean slate without affecting other replua instances. Installation -- lazy.nvim example { " mghaight/replua.nvim " , config = function () require ( " replua " ). setup () end , } If you prefer to manage configuration manually, require the plugin somewhere in your startup files: require ( " replua " ). setup () The bundled plugin/replua.lua file calls setup() on load, so the commands are available even without manual configuration. Usage Open the scratch buffer with: :RepluaOpen Need another scratch buffer? Run :RepluaOpen! for a fresh instance. The default keymaps inside the buffer mirror Emacs-style interactions: Mapping Mode Action <localleader>e n Evaluate the current line <localleader><CR> n Evaluate the surrounding block <localleader>r n Evaluate the entire scratch buffer Each evaluation appends comment lines such as -- => result or -- print: output , and drops you onto a new blank line ready for more Lua. Additional commands: :RepluaEval — Evaluate the entire scratch buffer. — Evaluate the entire scratch buffer. :RepluaOpen! — Create a new replua buffer with a fresh environment. — Create a new replua buffer with a fresh environment. :RepluaReset — Reset the Lua environment used for evaluation. Because the environment proxies _G , anythin...
First seen: 2025-10-20 00:03
Last seen: 2025-10-20 05:03