Skip to content

lokop5116/NvimRunner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🏃‍♂️ NvimRunner

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.

Features

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

Demonstration

demo_runner.mp4
toggle_demo.mp4
test@DESKTOP-EAKT3B1_._playground.2025-05-03.17-09-52.mp4

Languages Supported

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}"

Installation

Installl using any plugin manager.

Recommended to use lazy.nvim:

  {
  "lokop5116/NvimRunner",
  opts = { -- your configuration
    compilers = {},
    }
}

Configuration

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}" 

About

Run your code inside nvim. Add your own languages easily.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages