Skip to content

connorgmeehan/paddynvim

 
 

Repository files navigation

PaddyNvim

> Next Generation of LuaPad

⚡️ Features

Write short sentences describing your plugin features

  • FEATURE 1
  • FEATURE ..
  • FEATURE N

📋 Installation

Package manager Snippet

folke/lazy.nvim

-- stable version
require("lazy").setup({{"connorgmeehan/paddynvim"}})
-- dev version
require("lazy").setup({"connorgmeehan/paddynvim", branch = "dev"})

☄ Getting started

Install and setup the plugin, then run the :Paddy command.

⚙ Configuration

Click to unfold the full list of options with their default values

Note: The options are also available in Neovim by calling :h paddynvim.options

require("paddynvim").setup({
    -- Prints useful logs about what event are triggered, and reasons actions are executed.
    debug = false,

    ---@type function Callback function called after creating new Paddy instance.
    on_init = nil,
    ---@type table The default context tbl in which luapad buffer is evaluated. Its properties will be available in buffer as "global" variables.
    context = nil,

    ---@type table Options related to preview windows
    preview = {
        ---@type boolean Show floating output window on cursor hold. It's a good idea to set low update time. For example: `let &updatetime = 300` You can jump to it by `^w` `w`.
        enabled = true,
        ---@type number minimum height of the preview window.
        min_height = 10,
        ---@type number maximum height of the preview window.
        max_height = 30,
    },

    ---@type PaddyIntegration[] List of integrations to attach to the Paddy buffer. The Evaluator is the default integration and is always active.
    integrations = { Evaluator },

    ---@type number Luapad uses count hook method to prevent infinite loops occurring during code execution. Setting count_limit too high will make Luapad laggy, setting it too low, may cause premature code termination.
    count_limit = 2 * 1e5,
    ---@type boolean Show virtual text with error message (except syntax or timeout. errors).
    error_indicator = true,
    ---@type string Highlight group used to coloring luapad print output.
    print_highlight = "Comment",
    ---@type string Highlight group used to coloring luapad error indicator.
    error_highlight = "ErrorMsg",
    ---@type boolean Evaluate all luapad buffers when the cursor moves.
    eval_on_move = false,
    ---@type boolean Evaluate buffer content when it changes.
    eval_on_change = true,
    ---@type 'split'|'vsplit' The orientation of the split created by `Luapad` command. Can be `vertical` or `horizontal`.
    split_orientation = "vsplit",
    ---@type boolean The Luapad buffer by default is wiped out after closing/loosing a window. If you're used to switching buffers, and you want to keep Luapad instance alive in the background, set it to false.
    wipe = true,
})

🧰 Commands

Command Description
:Paddy Creates a new paddy buffer .

⚙ Integrations

PaddyNvim is extensible via integrations.

CPML (Linear Algebra and Vector Math)

Vendored from the cpml math library, it will inject linear algebra and vector math primitives into the context of all your paddy pads.

Enabling

local cpml = require('paddynvim.integrations.cpml')
require('paddynvim').setup({
    integrations = { cpml },
})

Using

--- In a paddy buffer.
local vec2 = cpml.vec2

local v1 = vec2.new(5, 10)
local v2 = vec2. new(10, 5)
print(v1 + v2) -- (+15.000,+15.000)

⌨ Contributing

PRs and issues are always welcome. Make sure to provide as much context as possible when opening one.

🗞 Wiki

You can find guides and showcase of the plugin on the Wiki

🎭 Motivations

Special thanks

The idea and basically all the sourcecode was ripped from rafcamlet. I just updated some API calls and added a vector math integration.

About

Interactive real time neovim scratchpad for embedded lua engine - type and watch!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 98.3%
  • Shell 1.2%
  • Makefile 0.5%