[ANN] Piecetab — Lua-friendly building blocks for text editors
Xavier Wang <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <CAPsVyB8LE=un5ZsQwaMqZL4=0xu+sMaOwwxdGBM3ttQJAs5vqA@mail.gmail.com> |
Hi all, I'd like to announce Piecetab: a set of libraries for building text editors, designed to be used from Lua. The repo ships Lua bindings and declaration files for all core C components, plus an editor.lua demo showing how to assemble a working modal editor in Lua. In particular, the piecetab Lua binding bundles piecetab / linecache / undotree into a single file-like document interface: it supports both byte and line positions with bidirectional lookup, and each commit automatically creates an undo-tree node — so you can jump back to any previous editing state. To running the Lua demo, using `just lua/deps` to build bindings, then run demo with `lua editor.lua [file]`. To enable syntax highlighting, you should have libtree-sitter installed, and using `just lua/ts` to build and install grammars, then the syntax highlighting will be enabled automatically. There is also a pure Lua module `lsp.lua` implements the basic lsp client. Other Lua bindings include: spantree — span/attribute coloring for highlighting and diagnostics cellgrid — screen buffer with efficient redraw diff termfeed — terminal input, a modern rewrite of libtermkey (CSI/SS3, UTF-8, alt keys, mouse, OSC52) json — vendored yyjson binding treesitter — binding over libtree-sitter for incremental syntax highlighting All C bindings also include .d.lua declaration files, so Lua Language Server (luals) can provide type checking and autocompletion. On the C side, the libraries are stb-style single-header C89 — lightweight, self-contained, and easy to embed. All stb-style headers are 100% line covered, and 95+% branch covered. Repository: https://github.com/starwing/piecetab License: MIT I'd appreciate any feedback, especially from people interested in editors, terminal UIs, or Lua/C integration. Thanks! -- regards, Xavier Wang. -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAPsVyB8LE%3Dun5ZsQwaMqZL4%3D0xu%2BsMaOwwxdGBM3ttQJAs5vqA%40mail.gmail.com.