Building my own Vi text editor in BASIC

· coding devtools · Source ↗

TLDR

  • Dev built yvi, a working Vi clone in ~500 lines of Yabasic, supporting modal editing, word navigation, search, undo, and file I/O.

Key Takeaways

  • yvi implements core Vi commands: hjkl movement, insert/normal mode, dd, gg/G, word navigation, search, u undo, S overwrite, c cut-insert.
  • Written in Yabasic, a 25-year-old actively maintained BASIC dialect; author claims it is the only Vi clone in any BASIC implementation.
  • No line wrapping; display truncates at 80 chars with line/column shown in status bar, keeping implementation simple.
  • Grew from ~100 lines for basic layout to ~500 as compound commands, number prefixes (1-9), and more Vi verbs were added.
  • Author uses yvi in production for writing and coding, including authoring this post itself; warns against using it for anything critical due to known bugs.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN