#low-level #internal #module #ffi #header #zle

sys zsh-sys

Low-level bindings to dynamically-loadable zsh internals

4 releases

Uses new Rust 2024

new 0.2.1 May 12, 2026
0.2.0 Apr 23, 2026
0.1.1 Feb 2, 2024
0.1.0 Jan 16, 2023

#60 in #internal


Used in zsh-module

MIT/Apache

17KB
268 lines

zsh-sys CI

This crate provides low-level FFI bindings to the ZSH API. It allows users to interact with ZSH internals and create ZSH modules in Rust. This crate is intended for advanced users who want to have more control over their ZSH modules and are comfortable working with unsafe code.

Quick Start

Add zsh-sys as your dependency in Cargo.toml

cargo add zsh-sys

Usage

Raw bindings to zsh's core headers are re-exported at the crate root:

use zsh::{Module, Builtin};

Bindings for zsh's bundled modules are split behind feature flags and exposed under namespaced submodules (boot, setup, features, enables, cleanup, finish):

// requires the `zle` feature
use zsh::zle::complist;

unsafe { complist::setup(module) };

Most users should prefer the higher-level zsh-module crate, which wraps these bindings in a safe API.

Features

  • zle — bindings for Src/Zle (types, functions, and the following modules: zutil, compctl, complist, computil, zleparameter)
  • builtins — bindings for Src/Builtins (rlimits, sched)
  • modules — bindings for Src/Modules (datetime, langinfo, parameter, termcap, terminfo, zutil)
  • all (default) — enables all of the above

Credits

This crate is the fork of zsh-module-rs and I appreciate the efforts of @Diegovsky and other contributors.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–1.9MB
~37K SLoC