No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-15 12:01:44 +01:00
src v3 fixes: insert-mode Enter on the last line now splits (buf.insertText tail-eat only for just-appended EOF lines; fake buffer parity); tree root = first file arg's folder instead of process cwd; zig build run step 2026-11-15 12:01:44 +01:00
.gitignore v3-M5: demolish the Pascal tree (~5.7k LOC + 64MB vim bundle + build scripts + tests), README rewritten for the Zig/Wayland app; .gitignore slimmed 2026-11-12 01:18:30 +01:00
build.zig v3 fixes: insert-mode Enter on the last line now splits (buf.insertText tail-eat only for just-appended EOF lines; fake buffer parity); tree root = first file arg's folder instead of process cwd; zig build run step 2026-11-15 12:01:44 +01:00
build.zig.zon v3-M0: Zig+Wayland skeleton — build.zig (translate-c + scanner codegen), xdg toplevel lifecycle, SHM double-buffer, resize, theme port, freetype hand-externs 2026-11-11 21:56:32 +01:00
README.md v3-M5: demolish the Pascal tree (~5.7k LOC + 64MB vim bundle + build scripts + tests), README rewritten for the Zig/Wayland app; .gitignore slimmed 2026-11-12 01:18:30 +01:00

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, ~).
  • 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).