• V H@lemmy.stad.social
    link
    fedilink
    arrow-up
    8
    ·
    1 year ago

    Do it. It's fun.

    My advice is to start small, and look at some simple examples. E.g. I knew I wanted mine to run in a terminal, and I love Ruby, so I started with Femto which is a really tiny Ruby editor. By itself, it's pretty useless (but beautifully written), but it was remarkably quick to get to something that was "tolerable" for light editing, and then I iterated from there.

    There are many options for small ones for all kinds of different values of "small" that can serve as inspiration. E.g. Linus Torvalds has his own branch of MicroEmacs (as do many others, it's a popular starting point, and the basis for e.g. Pico, mg, Vile). Antirez (of Redis fame) has Kilo, so named because it was written to be <1k lines excluding comments, and there's an "instruction booklet" on how to write one that's using Kilo to demonstrate approaches to writing one.

    The first starting point, I think is deciding how general you want it to be. E.g. I early on decided I don't care at all about being able to use it as my only editor ever, and that meant I could pick and choose use-cases that were out of scope. For example, I just want to edit "human-scale" files, not multi-GB datasets or log files - I'm happy to open that in Emacs if I ever need it - and so that gave me far more flexibility in terms of data structures because I don't need it to scale beyond a few thousand lines, and that saved me a lot of effort.