Hello, and welcome to "The Chronicles of Duat"!
This is a blog for me to archive journey of creation for my text editor duat. This is a text editor that is build and configured in Rust. It has been in development for quite some time, and in that time, I have learned a lot about softwared development, how to make complex systems work, and how to make extendable systems.
Most of my struggles with duat's development stem from challenges of the API, where I want things to be consistent, predictable, and hard to mess up. This blog will contain my thoughts about various parts of the process to get here, including past developments that I decided were worth posting about here.
The many hours mulling over decisions on what shape the API should take have resulted in a public interface that (IMO) is quite pleasant to use:
setup_duat!(setup);
use duat::prelude::*;
fn setup(opts: &mut Opts) {
opts.wrap_lines = false;
opts.highlight_current_line = true;
opts.scrolloff.y = 5;
map::<Insert>("jk", "<Esc>");
hook::add::<BufferOpened>(|pa, buffer| {
let buf = buffer.write(pa);
match buf.filetype() {
Some("html" | "cpp" | "c") => buf.opts.tabstop = 2,
Some("markdown") => buf.opts.wrap_lines = true,
_ => {}
}
});
}
Above is a simple example of a configuration file for Duat. It took quite a while for that to look the way it does. And in this blog, I hope to take you through my journey to get there.