Skip to content

0x100101/lab.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👩‍🔬 lab.nvim

Heads up: lab.nvim is still very early in development and should be considered beta.

Goal

  • Provide a collection of unique prototyping tools for neovim.
  • These tools should be extremely configurable and modular in nature.

Features

Code Runner

  • The foundational feature for lab.nvim is a code runner with real-time, inline feedback. (Inspired by runjs, quokka and others.)
  • The code runner currently supports JavaScript, Typescript, Python, and Lua with additional language support planned.
  • The goal of the code runner isn't to be a full-fledged debugger, rather it aims to provide a simple rapid feedback mechanism that can be useful while working on prototyping tasks.
js_code_runner.mp4

Commands

Command Action
Lab code run Run or resume the code runner on the current file.
Lab code stop Stop the code runner on the current file.
Lab code panel Show the code runner info buffer.
Lab code config Show the code runner config for the current file.

Note: that the run command is also automatically invoked each time you save changes to a file that is currently active.

Languages

Language Supported
JS / TS console, debugger, error
Python print, breakpoint, error
Lua print, error

Quick Data

  • The quick data feature allows you to quickly insert fake data while prototyping.
  • The implementation works by providing a dynamic snippet source to nvim-cmp.
  • This feature currently supports fakerjs as a pre-configured data source.
quick_data.mp4

Configuration

  • Add the source to your nvim-cmp setup:
sources = cmp.config.sources({
  { name = 'lab.quick_data', keyword_length = 4 }
}, 
  • This feature is enabled by default but can be disabled:
require('lab').setup {
  quick_data = {
    enabled = false,
  }
}

Requirements

  • neovim >= 0.7.2
  • plenary.nvim
  • node >= 16.10.0

Optional Requirements

  • Python 3 (Python code runner)
  • Lua 5.4 (Lua code runner)
  • nvim-cmp (Quick data snippets)

Example Setup

Important: Notice the post install hook. Lab.nvim has a few internal node dependencies that should be installed. See: package.json

Plug 'nvim-lua/plenary.nvim'
Plug '0x100101/lab.nvim', { 'do': 'cd js && npm ci' }

require('lab').setup {
  code_runner = {
    enabled = true,
  },
  quick_data = {
    enabled = true,
  }
}

nnoremap <F4> :Lab code stop<CR>
nnoremap <F5> :Lab code run<CR>
nnoremap <F6> :Lab code panel<CR>

About

Prototyping Tools for Neovim

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •