Skip to content

vi013t/input.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

input.nvim

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.

๐Ÿš€ Example

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:

output

โšก Features

  • โœ… 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.

About

A Neovim library for getting validated data from users.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages