4-minute read
OR: Reinventing a (crappier) Vi(m)
This is a post about my new text editing program yvi.
I like reinventing wheels. At least I do when it comes to making things like art , craft, food, or code. It’s how I learn. And it’s how I can shape tools or work to fit my own mind. I think because my background is in art, and because I didn’t formally learn Computer Science, despite the fact that I teach it, my software has a bit of a handmade feel to it.
As a case in point, I’ve built my own static website creator panblog when I grew frustrated with other more well-known alternatives that were clunky, poorly documented, or bloated pieces of software.
I’m also drawn to programming languages and paradigms that are a bit out of step with the mainstream and especially silicon valley’s current conception of software. For example, I love glue languages, languages and libraries for learners, and am a fan of scripting languages. My favorites are Lua, Bash, Fish, Forth-likes and BASIC.
Last year I spent a couple months researching and writing BASIC, specifically the Yabasic dialect, which is about a quarter century old and continously maintained. While I’ve been recommended by online friends to try out some other variants, I’ve found it easy to use and well-documented. It’s not the greatest for building graphical user interfaces, at least in my experience, but I use L5, or Processing-p5 libraries for that.
For a modern BASIC, it’s quite fun to use. I made my own cyber-hoss racing game , a command line game inspired by the UFO50 and Flash game Quibble Race. I also tinkered with the internals of the text version of The Oregon Trail, and built a clone, a simple version of Dope Wars economic simulation game.
Recently I came across The People’s Permacomputer, a project by Vidak, which led me to the online home for a great active BASIC Programming forum and various linked projects to build a 1970s style computer from scratch. I’ve been using Neovim (and before that, Vim) for years and years. I’ve never made a text editor before. But I decided it could be fun to try to implement my own. Vi seemed like a tall order to implement, but I’ve been using Offpunk, a small simple (arguable what this means) TUI client for browsing the internet including the world wide web and Gemini protocol. It has just a few implemented shortcuts like h/j/kl and g and G and others for moving around. So inspired by this, I thought I could likely build an ULTRA simple editor with a mininum of Vim commands. How hard could it be?
Well, it wasn’t too hard! With Yabasic in a hundred lines of code or so I quickly implemented the basic layout of a minimal blank page and added in those simple Vi commands for moving around and switching between insert and normal modes. I added the ability to open a file or start a new one. And to save. This was satisfying as I was now able to open the actual code for my vi.bas program and poke around and edit it. An early decision I made was what to do about wrapping. I decided to not have it as that simplified my program. As a compromise, you can write as much as you want on a line, but it only displays up to 80 chars, and in the status line at the bottom it shows your line number and character number.
... continue reading