| Crates.io | duat |
| lib.rs | duat |
| version | 0.8.3 |
| created_at | 2023-10-31 04:18:35.585254+00 |
| updated_at | 2026-01-16 01:51:24.210383+00 |
| description | A modern, very customizable text editor, configured in rust. |
| homepage | |
| repository | https://github.com/AhoyISki/duat |
| max_upload_size | |
| id | 1019342 |
| size | 339,993 |

Duat is a text editor with sane defaults, while still having an incredible amount of modularity, to the point where you can replace pretty much anything.
It is written and configured in Rust, through the use of a config crate. The configuration can then be reloaded without closing Duat, by being recompiled as requested.
I know that Rust isn’t really a scripting language, but I’ve worked really hard to make this API intuitive to use, whilst still maintaining all the safety and expressiveness that Rust is known for.
Rust is also known for long compile times, but for Duat, I’ve managed to reduce the vast majority of reloads to under ~1.3 seconds, with a large chunk taking less than 800 ms (on my relatively old mid range laptop).
Do keep in mind that this is a work in progress, so there might be bugs. Any feedback on features, bugs or requests is highly appreciated 🥰.
To install Duat, I am assuming that you have cargo installed on
your system, if you don’t, install it. If you are installing it
on Windows, you should additionlly follow the instructions that
they give you for installing C/C++ libraries through Visual
Studio.
On this section, I will be referring to duat’s configuration by
~/.config/duat/, but you should replace it with your operating
system’s config path. The same also applies to ~/.local/duat/.
Next, in order to run duat, you should add ~/.cargo/bin/ to your
$PATH variable. Alternatively, you can just add
~/.cargo/bin/duat, if you want to add just duat to the
$PATH. Now, you can install duat:
cargo install duat
That is the recommended version, however, if you wish to install the bleeding edge version, you can call this instead:
cargo install --git https://github.com/AhoyISki/duat --features git-deps
When you first run duat, you will be prompted for the creation
of a new configuration crate in ~/.config/duat/ (unless it
already exists).
In the configuration’s src/lib.rs, there should be a
setup_duat! macro, which takes in a function with no parameters.
This function is the setup for duat, and it can be empty, which is the equivalent of the default configuration for Duat.
Here’s an example configuration buffer, which makes use of the
duat-kak crate, which is a plugin for Duat. This plugin, like
all others, is included without the duat_ prefix, so in the
config it is just kak.
setup_duat!(setup);
use duat::prelude::*;
fn setup() {
map::<Insert>("jk", "<Esc>");
opts::set(|opts| {
opts.wrap_lines = true;
opts.scrolloff.y = 5;
opts.line_numbers.align = std::fmt::Alignment::Right;
});
opts::fmt_status(|pa| {
let upper_mode = mode_name().map(|m| m.to_uppercase());
status!("[mode]{upper_mode}{Spacer}{name_txt} {sels_txt} {main_txt}")
});
hook::add::<ModeSwitched>(|_, (_, new)| match new {
"Insert" => cursor::set_main(CursorShape::SteadyBar),
_ => cursor::unset(),
});
form::set("mode", Form::dark_magenta());
}
This configuration does the following things:
Insert mode;Buffer, LineNumbers and StatusLineThese are only some of the options available to configure Duat,
you can also add custom commands, place widgets around other
Widgets and windows, create parsers that can track every
change on a Buffer, and many other things.
Duat also comes with a fully fledged text creation system, which significantly eases the creation of highly formatted text:
let infix = "text";
let text = txt!("This {infix} is [form1]colored and {Spacer} distant");
In the example above, [form1] will change the style of the text
to the "form1" Form, while {Spacer} will place a spacer
in between the two parts of the text (See the status line in the
GIF, it uses spacers).
This macro works very similarly to the format! family of
macros, so you also have inlining, as you can see with the
{infix} part. All of this is, of course, checked at compile
time.
These issues asume that you are working with the --git-deps
version of duat
Try running the following:
duat --reload --clean
This will update all dependencies of the config, potentially solving compatibility issues. The problem may also be with some plugin you installed.
This is an indication that your installed version of duat became
incompatible with that of your config. Rerun the installation
process and call duat --reload.
When you install duat, the default config crate will come with the following plugins:
duat-catppuccin is a just a simple colorscheme plugin, it
adds the four flavors from the catppuccin colorscheme. You can
pick between the four of them, you can apply its colors to other
Forms and you can allow or disallow the colorscheme to set
the background color.It also comes with the following built-in plugins, which I will later on add the ability to disable:
duatmode is the default mode for editing in Duat. It is
heavily inspired by the Kakoune text editor in its design, with
some light differences.duat-treesitter brings tree-sitter to Duat in the form of
syntax highlighting and indentation calculation, which can be
used by Modes (such as those from duat-kak) in order to give
better feedback when editing buffers.duat-match-pairs adds matched parentheses highlighting to
duat. Has some ntegration with duat-treesitter.duat-base adds all of the default plugins that you see, like
the line numbers, status line, prompt line, etc.Duat provides a lot of features, trying to be as configurable as possible, here are some of the things that Duat is capable of:
Additionally, by choosing Rust as its configuration language, Duat also gains the following features:
These are the goals that have been accomplished or are on their way:
︙
An internal (and more detailed) TODO list, which might hard to
understand, can be found in TODO. This list will is
not a comprehensive roadmap, as I will ocasionally remove
entries from it, particularly those in the FOR NEXT UPDATE
section, when said update comes out.
NOTE: These are not set in stone, and may be done out of order.
I don’t know what your personal reasoning would be, but in my case, I really like Kakoune’s editing model, but was frustrated with the lack of some features, like folding, multiple buffer editing, the general barebonesness of the configuration, etc.
I know that Neovim has all of these features, and Helix supposedly tries to solve some of these issues. But I don’t really like either of their editing styles to be honest.
And so I thought, why not make my own text editor?
I thought, why not make a text editor that is as modular as possible, while still having a sensible default configuration? That I could modify however I wanted, and with a language that I love?
That’s why I decided to create Duat.
idk, cool sounding word that I got from Spelunky 2.