- Zig 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| README.md | ||
vimgui v3
A lean, keyboard-first editor with vim bindings, written in pure Zig on Wayland.
No GUI toolkit: one wl_surface, an SHM double buffer, FreeType glyphs —
Linux only, Hyprland-tested.
Build & run
zig build # binary at zig-out/bin/vimgui
zig build test # engine + unit suites (vim, buf, doc, tab, hl, editpane, atlas)
./zig-out/bin/vimgui [files...] [dir]
A file argument opens as a document; a directory argument sets the tree root (and defaults the tree to cwd when only files are given).
Features
- Vim engine ported 1:1 from the Pascal v2 core and extended, verified by
284+ nvim-oracle fixtures: motions (h j k l w b e 0 ^ $ gg G f/F/t/T),
operators (d c y) with all motions and counts (2d3w), doubled ops (dd cc yy),
x s r J ~, I A o O S C D, p/P (charwise + linewise), counts everywhere,
u / Ctrl-R undo (group per operator, insert session = one unit),
/search- n/N with E486,
.dot-repeat (operator/motion/insert-session replays, count-replace semantics), visual char/line (v V, d x y c, ~).
- n/N with E486,
- Ex verbs:
:w :q :wq :e :bn :bp— save is tmp-file + rename. - Tabs: mirrors open documents; ✕ close (22px strip or middle-click),
[+]opens a fresh [No Name] buffer. - File tree (220px panel): expand/collapse directories, click to open-or-switch documents, refreshes on save.
- Syntax highlighting: keyword-table highlighter (.zig .pas .c .h .py .md) in theme colors, per-document context cache keyed on buffer revision.
- Status bar: mode slot (NORMAL/INSERT/VISUAL), engine messages
(E486 etc.), dirty marker,
path | ln,col. - Theme: ported from the user's Zed theme (the-dark-side palette).
Architecture
src/
main.zig wayland client: xdg-shell lifecycle, SHM double buffer
app.zig input (xkb → KeyEvt), pointer, tab bar, tree panel, status
editpane.zig editor pane: scroll, caret blink, syntax draw, pane tests
buf.zig real buffer (line array) implementing the engine's vtable,
undo host, revision counter
vim.zig the vim engine (pure, host-agnostic, fixture-tested)
doc.zig document manager; tab.zig tab-bar math (ported from v2)
hl.zig keyword-table highlighter; ft.zig FreeType externs;
atlas.zig glyph cache; theme.zig palette
The engine (vim.zig) talks to the buffer through a small C-style vtable —
it is UI-free and testable headless against an nvim oracle
(nvim -n -u NONE -i NONE --headless replays fixtures via feedkeys).
History
v1/v2 were a Lazarus/LCL app embedding real vim over a PTY (deleted here — see git history). The process-lifetime-is-document-lifetime flaw and the sync channel's bug classes are gone: the GUI owns buffers, tabs and undo; vim is an input language, not a process.
Status
Daily-usable: editor + vim modes + tabs + tree + theme + scroll + save. Known gaps: no search-replace UI, no split windows, dot-repeat has no recorded-op menu (nvim parity for exotic ops is approximate).