duat-utils

Crates.ioduat-utils
lib.rsduat-utils
version0.6.0
created_at2025-06-16 06:01:13.972401+00
updated_at2025-08-20 13:37:19.367997+00
descriptionBasic components common in Duat, such as widgets and modes
homepage
repositoryhttps://github.com/AhoyISki/duat/tree/master/duat-utils
max_upload_size
id1713924
size171,935
ahoyiski (AhoyISki)

documentation

README

duat-utils License: AGPL-3.0-or-later duat-utils on crates.io duat-utils on docs.rs Source Code Repository

Standard complementary additions to Duat

This crate essentially consists of the standard bits that pretty much every config crate will want to use, but aren’t strictly speaking necessary for Duat to function. This split is mostly to improve compile times, but semantically, if a crate doesn’t need all of these extra things, it is nice to separate them out.

The crate has the following elements:

  • 5 widgets:

    • LineNumbers shows the numbers on a File (for now), and you can configure their alignment, relativeness, etc.
    • The PromptLine lets you run commands and do other things, like incremental search
    • The StatusLine lets you display information that gets updated automatically, it can show information from RwDatas, mapping functions, static elements, and every bit of Duat. It’s syntax, in status! is the same as the txt! macro.
    • Notifications shows things that have been logged to the Logs of Duat, through the error!, warn! and info! macros.
    • LogBook is a log of everything that has been notified to Duat. It is usually more admissive than Notifications, and is most commonly scrolled by the Pager Mode.
  • 3 modes:

    • Regular is essentially the standard Mode that text editors use. Sort of like VSCode.
    • Prompt is a multitool that can serve many purposes, through the PromptMode trait, which allows one to act on the PromptLine while abstracting over less important elements of the Widget.
    • Pager is a simple, read only Mode, designed for scrolling and searching through Widgets, most commonly the LogBook.
  • For the PromptLine, there are 4 PromptModes:

    • RunCommands will interpret and run Duat commands, with syntax highlighting for correctness, defined by the Parameter trait.
    • PipeSelections will pipe each selection on the current File, replacing them with the return value from a shell command.
    • IncSearch is a specialized mode used for incremental search, which can abstract over what the search actually does with the IncSearcher trait.
  • For IncSearch, there are 4 IncSearchers:

Note that the IncSearcher trait can be used for many more interesting things, like in duat-kak for example, where its implementors allow for splitting selections, selecting everything within a range, and many more such things in the future.

And finally, there is the state module, which contains a bunch of StatusLine parts for you to customize the StatusLine with.

I would consider this crate essential for all configs of Duat out there, since it defines primitives that are not only hard to replace, but might also be very extensible by plugins in the ecosystem.

Commit count: 1644

cargo fmt