Plugin to run your current file inside Neovim. Works by running compile command to inbuilt terminal. Easy to specify your own compiler for any file extension.
Command | Description |
---|---|
:NvimRunner {arg} | Runs current file, {arg} specifies which way to split terminal ( v/h ) |
:ToggleAutoRun {arg} | Toggles autorun on, runs :NvimRunner {arg} everytime buffer is saved |
:DisableAutoRun | Toggles autorun off |
demo_runner.mp4
toggle_demo.mp4
test@DESKTOP-EAKT3B1_._playground.2025-05-03.17-09-52.mp4
Warning
Ensure that compiler for whatever language you run is already installed
Additional languages can be added yourself. See Configuration
While being run, {file} is replaced with filename ( + extension ) and {name} is replaced with filename ( without extension ).
For example for some test.c file,
Before substitution-
gcc {file} -o {name} && ./{name}
After substitution-
gcc test.c -o test && ./test
Language | Command Run |
---|---|
.sh | "./{file}" |
.cpp | "g++ {file} -o {name} && ./{name}" |
.c | "gcc {file} -o {name} && ./{name}" |
.py | "python3 {file}" |
.java | "javac {file} && java {name}" |
.rs | "rustc {file} && ./{name}" |
.rb | "ruby {file}" |
.pl | "perl {file}" |
.v | "iverilog {file} -o {name} && vvp {name}" |
Installl using any plugin manager.
Recommended to use lazy.nvim:
{
"lokop5116/NvimRunner",
opts = { -- your configuration
compilers = {},
}
}
Adding your own language-
{
"lokop5116/NvimRunner",
opts = {
compilers = {
["file extension"] = "command to be run on terminal"
}
}
}
For example, adding clang++ as compiler for C++ files-
-- add this line to compilers
["cpp"] = "clang++ {file} -o {name} && ./{name}"