Build Your Own Text Editor, in C. And if you’re more versed into Rust or Racket, you are welcome too: In both cases, it is called remacs.