Skip to content

jignesh119/FlashRunner.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlashRunner.nvim

A blazing-fast Neovim code runner plugin for executing code snippets directly from your editor.

License: MIT

Features

  • Multi-language support: C++, JavaScript, Python
  • Smart selection: Runs the code block you heroically selected, or just bulldozes through the whole buffer if you forgot to select anything. Because who needs precision anyway?
  • Beautiful UI: Output floating window with mesmerizing markdown rendering
  • Asynchronous execution: Non-blocking code execution
  • Clean: Just forget about temp file storage, you're sorted!

Demo

FlashRunner Demo

Screenshots

Executing javascript code

Executing python code

Executing cpp code

Requirements

The interpreters/executables must be available on your path.

Core Dependencies

  • Neovim >= 0.8.0
  • Node.js (for JavaScript)
  • Python (for Python)

C++ Support (Optional but Recommended)

  • Cling - C++ interpreter for REPL-like experience

> Installation methods may vary by platform. For the most accurate and up-to-date instructions, please refer to the official sources:
> https://root.cern/install/

Installation

Using lazy.nvim

{
  'jignesh119/FlashRunner.nvim',
  config = function()
    require('FlashRunner').setup()
  end
}
use {
  'jignesh119/FlashRunner.nvim',
  config = function()
    require('FlashRunner').setup()
  end
}

Using vim-plug

Plug 'jignesh119/FlashRunner.nvim'

Then add to your init.lua:

require('FlashRunner').setup()

Configuration

Default Configuration

require('FlashRunner').setup({
  keymap = "<leader>Fr", -- Default keymap for visual mode execution
})

Usage

regular

  1. Select code in visual mode (v, V, or Ctrl+v)
  2. Press the keymap (default: <leader>Fr)
  3. View results in the floating window
  4. Press q to close the output window

Alternative: user_command based

:FlashRunnerShow

Build and Development Instructions

Set Up Dev Environment

  1. Clone the repository:

    git clone https://github.com/jignesh119/FlashRunner.nvim.git
    cd FlashRunner.nvim
  2. Make the shell script executable:

    chmod +x lua/FlashRunner/cling-runner.sh
  3. Install development dependencies:

    # Install required interpreters
    sudo apt-get install nodejs python3 cling  # Ubuntu/Debian
    # OR
    brew install node python cling             # macOS
  4. Link/Register plugin for development: you can load the plugin from a local directory using your plugin manager.

    Using lazy.nvim

return {
    dir = "/absolute/path/to/FlashRunner.nvim",
    config = function()
        require("FlashRunner").setup()
    end,
}

then sync to install/ register the plugin in neovim

:Lazy sync

then upon each update you may want to reload plugin

:Lazy reload FlashRunner

Follow this Blog post to understand how to build your neovim own plugin Dev.to step-by-step guide

Troubleshooting

Common Issues

  1. "No valid executor for this language"

    • We currently support C++, JavaScript, Python
    • Ensure the file has the correct filetype (:set filetype?)
    • Verify language support in selection.lua
  2. C++ execution fails

    • Install Cling interpreter
    • Check if cling-runner.sh is executable
    • Verify the script path in configuration
  3. JavaScript/Python execution fails

    • Ensure Node.js/Python is installed and in PATH
    • Test with node --version or python --version
  4. Floating window doesn't appear

    • Check for errors with :messages
    • Ensure Neovim version >= 0.8.0

Todo

  • RPC Integration: Handle interpretation in different programming languages
  • TypeScript Support: Add ts-node executor
  • More Languages: Rust, Go, Lua, PHP support
  • Configuration UI: Interactive setup and language configuration
  • Execution History: Save and replay previous executions
  • Custom Executors: User-defined execution commands
  • Integration: LSP integration for better error reporting

Acknowledgments

  • Heavily inspired by none other than teej (nvim gawd)

P.S AI assited in writing this readme

About

a simple neovim code runner plugin

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published