A simple plugin to run your code in a repl and display the results as virtual text inside neovim.
- Neovim >= 0.5
Install with your preferred package manager, the following example uses packer:
use {
"luissimas/eval.nvim",
config = function()
require("eval").setup()
end
}
The plugin can be configured via the setup
function, here is an example config with all the defaults:
require("eval").setup({
prefix_char = "> ", -- char displayed before the output content
-- a table with each filetype and its respective command to run code
filetype = {
lua = {
cmd = "lua"
},
javascript = {
cmd = "node"
}
})
The cmd
option must be an executable in your PATH
that read from stdin.
Eval exposes the command Eval
, which can be called in normal or visual mode. When called in visual mode, Eval
will evaluate the current selected text, when called in normal mode the entire buffer will be evaluated.