README.md

July 24, 2026 · View on GitHub

██╗    ██╗ ██████╗
██║    ██║██╔════╝
██║ █╗ ██║██║
██║███╗██║██║
╚███╔███╔╝╚██████╗
 ╚══╝╚══╝  ╚═════╝

License: MIT zmax plugin

[COUNT THE BUFFER — COMPILED]

"wc — one word, and the buffer's size is on the status line."

[NATIVE ZMAX PLUGIN]

:wc reports the current buffer's line / word / char / byte counts on the status line — the editor analog of the wc tool — as a native zmax plugin: a compiled Rust cdylib loaded at runtime over zmax's stable C ABI, no editor recompile.

zmax · zmax-native · docs


Table of Contents


[0x00] OVERVIEW

:wc          → 12 lines   47 words   310 chars   322 bytes

[0x01] INSTALL

:zmax-native add MenkeTechnologies/zmax-native-wc

zmax-native, zmax's package manager, clones the repo, runs cargo build --release, installs the cdylib into the content-addressed store under ~/.zmax/pkg/ (SHA-256 pinned), and dlopens it — by mmap, so the loader pages the library in. To self-install on first launch and load zero-network after, add one line to ~/.zmax/init.vim (the leading : is required):

:zmax-native get MenkeTechnologies/zmax-native-wc

Manual build

cargo build --release

Then, in zmax:

:zmax-native load ./target/release/libzmax_native_wc.dylib   # .so on Linux

[0x02] USAGE

Run :wc in any buffer. The counts appear on the status line: lines (a trailing newline is not counted as an extra line, matching how an editor reports line count), whitespace-separated words, Unicode scalar chars, and UTF-8 bytes.


[0x03] HOW IT WORKS

The plugin registers one typable command, wc, through the zmax-native SDK. On invocation it reads the whole buffer with the host buffer_text callback, then computes text.lines().count(), text.split_whitespace().count(), text.chars().count(), and text.len() (bytes), and posts the result with the host message callback. No dependencies.


[0xFF] LICENSE

MIT. Built against the zmax-native plugin SDK. See LICENSE.