{"id":27341829,"url":"https://github.com/josephburgess/nvumi","last_synced_at":"2026-04-05T23:11:14.400Z","repository":{"id":277413130,"uuid":"932204351","full_name":"josephburgess/nvumi","owner":"josephburgess","description":"Combining numi-cli and Snacks.scratch buffer to evaluate natural language expressions within Neovim","archived":false,"fork":false,"pushed_at":"2025-02-25T19:57:30.000Z","size":96,"stargazers_count":51,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T11:49:24.189Z","etag":null,"topics":["neovim-lua-plugin","neovim-plugin","neovim-plugins"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josephburgess.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-13T14:41:17.000Z","updated_at":"2025-10-06T06:27:13.000Z","dependencies_parsed_at":"2025-02-13T20:28:29.347Z","dependency_job_id":"6ab0a748-cd75-4a3f-bfa9-3a5bff7067a5","html_url":"https://github.com/josephburgess/nvumi","commit_stats":null,"previous_names":["josephburgess/nvumi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/josephburgess/nvumi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephburgess%2Fnvumi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephburgess%2Fnvumi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephburgess%2Fnvumi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephburgess%2Fnvumi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josephburgess","download_url":"https://codeload.github.com/josephburgess/nvumi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephburgess%2Fnvumi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim-lua-plugin","neovim-plugin","neovim-plugins"],"created_at":"2025-04-12T16:28:29.855Z","updated_at":"2026-04-05T23:11:14.392Z","avatar_url":"https://github.com/josephburgess.png","language":"Lua","funding_links":[],"categories":["Utility"],"sub_categories":["Cursorline"],"readme":"# nvumi\n\n**nvumi** is a Neovim plugin that integrates the [numi](https://github.com/nikolaeu/numi) natural language calculator with a scratch buffer. It lets you construct natural language expressions and see the results evaluated inline as you type.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/c0d0fd19-7acf-49db-96d2-0da9eda3b088\" alt=\"Gif\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\n### Using Lazy.nvim\n\n```lua\n{\n  \"josephburgess/nvumi\",\n  opts = {\n    virtual_text = \"newline\", -- or \"inline\"\n    prefix = \" = \", -- prefix shown before the output\n    date_format = \"iso\", -- or: \"uk\", \"us\", \"long\"\n    keys = {\n      run = \"\u003cCR\u003e\", -- run/refresh calculations\n      reset = \"R\", -- reset buffer\n      yank = \"\u003cleader\u003ey\", -- yank output of current line\n      yank_all = \"\u003cleader\u003eY\", -- yank all outputs\n    },\n    -- see below for more on custom conversions/functions\n    custom_conversions = {},\n    custom_functions = {}\n  }\n}\n```\n\n### Install `numi-cli`\n\nYou will also need **[numi-cli](https://github.com/nikolaeu/numi)**.\n\n**MacOS**\n\n```sh\nbrew install nikolaeu/numi/numi-cli\n```\n\n**Linux \u0026 Windows**\n\n```sh\ncurl -sSL https://s.numi.app/cli | sh\n```\n\n### Keybinding to open nvumi\n\nnvumi does not have a default keybinding to open the scratch buffer. You can set one:\n\n```lua\nvim.keymap.set(\"n\", \"\u003cleader\u003eon\", \"\u003cCMD\u003eNvumi\u003cCR\u003e\", { desc = \"Open nvumi\" })\n```\n\n## Usage\n\n1. Run `:Nvumi` to open a scratch buffer.\n2. Type a natural language expression (`20 inches in cm`).\n3. The result appears **inline** or on a **new line**, based on your settings.\n4. Press `\u003cCR\u003e` to refresh calculations.\n5. Use `\u003cleader\u003ey` to yank the current result (or `\u003cleader\u003eY` for all results).\n\n## Variable Assignment\n\nnvumi supports variables for storing values and reusing them in subsequent expressions. Variable names must start with a letter or underscore, followed by letters, numbers, or underscores.\n\n```text\nx = 20 inches in cm\ny = 5000\nx * y\nx + 5\ny meters in kilometers\n```\n\n- `x` stores the result of `20 inches in cm`\n- `y` holds `5000`\n- Expressions like `x * y` use the stored values\n\nPressing `R` to reset the buffer also clears all stored variables.\n\n## Custom Conversions\n\nnvumi supports user-defined unit conversions beyond what `numi-cli` provides. This was inspired by the [plugins](https://github.com/nikolaeu/numi/tree/master/plugins) that exist for the numi desktop app (those should be compatible with nvumi too).\n\n- Define custom units with **aliases**, a **base unit group**, and a **conversion ratio**\n- Custom conversions must share the same `base_unit` (e.g., `\"speed\"`, `\"volume\"`)\n- Ratios are relative to the base unit\n\n```lua\n{\n  opts = {\n    custom_conversions = {\n      {\n        id = \"kmh\",\n        phrases = \"kmh, kmph, klicks, kilometers per hour\",\n        base_unit = \"speed\",\n        format = \"km/h\",\n        ratio = 1,\n      },\n      {\n        id = \"mph\",\n        phrases = \"mph, miles per hour\",\n        base_unit = \"speed\",\n        format = \"mph\",\n        ratio = 1.609344, -- 1 mph = 1.609344 km/h\n      },\n    },\n  }\n}\n```\n\n| Input                  | Output        |\n| ---------------------- | ------------- |\n| `10 gallons in liters` | `37.8541 L`   |\n| `5 kmh in mph`         | `3.10686 mph` |\n\n## Custom Functions\n\nnvumi supports user-defined functions with aliases. Functions receive arguments (numbers or strings, or nothing) and return computed results. You can include error messages that will surface if something goes wrong.\n\n```lua\n{\n  opts = {\n    custom_functions = {\n      {\n        def = { phrases = \"square, sqr\" },\n        fn = function(args)\n          if #args \u003c 1 or type(args[1]) ~= \"number\" then\n            return { error = \"square requires a single numeric argument\" }\n          end\n          return { result = args[1] * args[1] }\n        end,\n      },\n      {\n        def = { id = \"greet\", phrases = \"hello, hi\" },\n        fn = function(args)\n          local name = args[1] or \"stranger\"\n          return { result = \"Hello, \" .. name .. \"!\" }\n        end,\n      },\n      {\n        def = { phrases = \"coinflip, flip\" },\n        fn = function()\n          return { result = (math.random() \u003e 0.5) and \"Heads\" or \"Tails\" }\n        end,\n      },\n    },\n  }\n}\n```\n\n| Input           | Output                                               |\n| --------------- | ---------------------------------------------------- |\n| `square(5)`     | `25`                                                 |\n| `square(\"abc\")` | `\"Error: square requires a single numeric argument\"` |\n| `hello(\"Joe\")`  | `\"Hello, Joe!\"`                                      |\n| `flip()`        | `Heads` / `Tails`                                    |\n\n## Inline `{}` Evaluations\n\nExpressions inside `{}` are evaluated first and the result is substituted into the full line before processing. This is particularly useful with custom functions or conversions, where passing a raw expression as an argument would confuse the parser.\n\n| Input                 | Step 1 - Evaluate `{}` | Step 2 - Final Output |\n| --------------------- | ---------------------- | --------------------- |\n| `log({10*10}, {5+5})` | `log(100, 10)`         | `2`                   |\n| `{10+20} mph in kmh`  | `30 mph in kmh`        | `48.28032 km/h`       |\n\n## Virtual Text Modes\n\nnvumi supports two virtual text modes:\n\n- **Inline** (default)\n- **Newline**\n\n\u003cdetails\u003e\n  \u003csummary\u003eInline\u003c/summary\u003e\n  \u003cp\u003e\n    \u003cimg src=\"https://github.com/user-attachments/assets/dae054cc-bddb-49c2-802a-68bfc9108d49\" alt=\"Inline Screenshot\" /\u003e\n  \u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eNewline\u003c/summary\u003e\n  \u003cp\u003e\n    \u003cimg src=\"https://github.com/user-attachments/assets/f7222430-4cb4-4eb7-a155-477d70dc39ff\" alt=\"Newline Screenshot\" /\u003e\n  \u003c/p\u003e\n\u003c/details\u003e\n\n## Date Formatting\n\n| **Format** | **Example Output**  |\n| ---------- | ------------------- |\n| `\"iso\"`    | `2025-02-21`        |\n| `\"us\"`     | `02/21/2025`        |\n| `\"uk\"`     | `21/02/2025`        |\n| `\"long\"`   | `February 21, 2025` |\n\n```lua\nopts = {\n  date_format = \"iso\", -- or: \"uk\", \"us\", \"long\"\n}\n```\n\n## Extra Commands\n\n| Command         | Description                                                   |\n| --------------- | ------------------------------------------------------------- |\n| `NvumiEvalLine` | Run nvumi on **any line** in any buffer |\n| `NvumiEvalBuf`  | Run nvumi on the **entire buffer** anywhere (this will probably be messy...)    |\n| `NvumiClear`    | Clears the buffer's virtual text                         |\n\n## `.nvumi` filetype\n\nnvumi uses a custom filetype `.nvumi` so that the autocommands don't trigger on arbitrary buffers. As a side effect, you can create and save `.nvumi` files outside of the scratch buffer and they work exactly the same.\n\n## Wiki\n\nThere is a [Wiki](https://github.com/josephburgess/nvumi/wiki) with more detail, including a [Recipes](https://github.com/josephburgess/nvumi/wiki/Recipes) page with example custom conversions and functions.\n\n## Contributing\n\nThis is my first attempt at a Neovim plugin, so contributions are more than welcome. If you encounter issues or have ideas for improvements, please open an issue or submit a pull request on GitHub.\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n## Acknowledgements\n\n- **[numi](https://github.com/nikolaeu/numi):** The natural language calculator this plugin wraps.\n- **[Snacks.nvim](https://github.com/folke/snacks.nvim):** The Lua runner built into snacks.Scratch inspired this idea. Snacks is no longer a dependency but still worth a shout out. Thanks @folke.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephburgess%2Fnvumi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosephburgess%2Fnvumi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephburgess%2Fnvumi/lists"}