Ito 开源 Lua 终端 UI 框架:支持实时预览与 LLM 辅助编码,专为 Neovim 用户打造

原标题:Show HN: Ito – Build Terminal UIs in Lua
48AI 研判分

开发者推出名为 Ito 的开源库,允许使用 Lua 构建终端用户界面(TUI),并提供类似 SwiftUI 的声明式 API。该工具针对 Neovim 爱好者设计,支持实时预览和错误回退机制,并附带 llms.txt 文件以优化 AI 辅助编程体验。

关联知识实体

报道正文

本文目录3 个章节

Build your own terminal UI.

Your earlier drafts are still available.

Start heremain.luaSomething needs a look.

文本

PreviewGetting your workspace ready…A few things to try+

The same Lua

Start with require("ito") and return a function that builds a view. Use ito.state(value) for values that change.

Compose with VStack, HStack, Text, and the controls in ito.md.

Views and modifiers

Use :spacing(1), :padding(2), :grow(), :bold(), and :dim() to arrange and style your views.

Try your changes

Your preview updates as you edit. If an edit has an error, the last working preview stays visible.

Try Input flow for keyboard navigation, editing, and cancellation. Use the expand icon for fullscreen. Open ito.md for a guide you can give your LLM.


作者发帖说明(HN):

My friend and I are huge Neovim nerds. We like to rice our terminals and our editors. We just wanted a harness that we can do the same with, rice it till our hearts' desire. So, we started looking out for harnesses. Pi was great, Pi was good. But in the end, it was JavaScript. I don't have anything against JavaScript, but Lua is more fitting, and I can just as easily base it in Rust to make it even faster. So, we started cooking, and we ended up with a design that's minimal at its core and is built using Lua. Every built-in abstraction, the way you define providers, the way you rice it up, everything, literally everything, you can do in Lua.

But how? How does it all work? I proposed we just do it the Ratatui way, but my friend was like, nah! We shall make it possible to build TUIs in Lua. (Weirdo!) But it paid off, and we got ourselves a shiny new Lua library, ito!!!

He didn't get the gravity of the situation. We had an awesome terminal UI library in Lua! I wanted everyone to know how cool that is, so I got cooking, wrote myself a custom canvas implementation of this library instead of the usual terminal adaptor, exported it as wasm, and made this super cool website where you can experiment building awesome UIs in Lua. For vibe-coders, we got an llms.txt too. Have at it, and see if you can build something really cool with it. The library's at github.com/uji-labs/ito, and the awesome sauce harness is at github.com/uji-labs/uji.

I hope you like it!