Warning: input.nvim
is not complete yet. It may/will not work.
input.nvim
is a Neovim library that creates window prompts for users and validates data.
This input code:
local input = require("input")
local primitives = require("input.primitives")
local string = primitives.string
local integer = primitives.integer
input(
{
name = string(),
age = integer():positive():max(100),
address = {
street = integer():positive(),
city = string(),
state = string():one_of({ "NY", "PA" }),
zip = string():length(5):match("^%d+$"),
apartment = string():optional()
}
},
{
on_complete = function(person_info)
print(vim.inspect(person_info))
end
}
)
Creates this window:
- โ Automatically validate inputs with a variety of provided utility functions
- โ๏ธ Validate inputs with custom functions
- ๐ถ Shows all input prompts in the order they're declared
- ๐ค Automatically converts input names into title case
- ๐ฆ Runs asynchronously, executing a callback upon completion
For a full list of provided functions, see primitives.lua.