HN
Today

Building my own Vi text editor in BASIC

The author embarked on a delightful journey of 'reinventing the wheel' by building 'yvi', a minimalist Vi-like text editor, using the quarter-century-old BASIC dialect, Yabasic. This unconventional project showcases a deep technical curiosity and a handmade approach to software, resonating with Hacker News' appreciation for DIY tools and retro programming. It's a testament to learning through creation and shaping tools to fit one's own mind, even if it means writing a "crappier" version.

8
Score
0
Comments
#9
Highest Rank
12h
on Front Page
First Seen
May 6, 11:00 PM
Last Seen
May 7, 10:00 AM
Rank Over Time
18131091414202021222527

The Lowdown

Driven by a philosophy of learning through creation and a preference for unconventional programming paradigms, the author, whose background is in art rather than formal Computer Science, decided to build their own text editor. This project, dubbed 'yvi', is a simplified Vi implementation crafted in Yabasic, an actively maintained BASIC dialect from 25 years ago.

  • The author enjoys "reinventing wheels" in art, craft, food, and code as a learning method, leading to a "handmade feel" in their software.
  • They are drawn to "out of step" programming languages like Lua, Bash, Fish, Forth-likes, and particularly BASIC, specifically Yabasic.
  • Previous Yabasic projects include a cyber-hoss racing game, a clone of The Oregon Trail, and a Dope Wars simulation.
  • Inspired by projects like The People's Permacomputer and a BASIC programming forum, and being a long-time Vim/Neovim user, the author decided to tackle building a simple text editor.
  • Initially, a minimal yvi was implemented in about 100 lines of Yabasic, supporting basic navigation (h/j/k/l), insert/normal modes, file open/new, and save.
  • A key design choice was to forgo word wrapping, displaying only 80 characters per line, with full line content accessible.
  • The program expanded to around 500 lines, adding more commands like word navigation, line deletion (dd), command composition, numeric prefixes (1-9), a search feature, and undo (u).
  • Further features like line overwrite (S) and cut-and-insert (c) were later integrated, making yvi functional enough for the author to write this very post within it.

Despite acknowledging existing bugs and advising against its use for critical work, the author expresses pride in building a functional, extensible text editor that serves their basic writing and simple coding needs, noting it might even be the only Vi clone written in BASIC.