How I Learned to Stop Worrying and Love the VIM
My journey from 1990 with a 286 PC and VIM, to 2021 with a Zen 3 PC and VIM . Where did it all go wrong ?
I’ve been programming for around 30 years. I’ve had many ups and many downs. This is something that I have learnt though — good tech sticks, embrace it as soon as you can, and watch the rest, the fads, come and go, the Zeitgeist is dynamic not static, (wow programming really has changed the way I talk now).
When I first started University, circa 1990, I had a 286 PC running DOS, it was lean and mean with 2MB of memory, VGA graphics, 20MHz CPU, and had a 20MB hard drive, (on this I ran a “disk doubler” called Stacker, that made it 10 times slower, but doubled my storage — total “win win”, no ?). It was smoking….well not quite, but it did actually end up literally smoking eventually.
One of the things it did have though was a GUI, a graphical user interface. I could run windows 3.1, and mostly everything on the screen was controllable via the mouse. Pretty windows and dialogs, with graphical icons adorned my 14 inch 256 color monitor. “Wow, super easy, just point, come on…..get over there, oh busy cursor hold on, wait for the egg timer……then click, click, did it click ? Try it again, click, and yes ! It saved, I am safe now from the transient, the volatile, I have persisted.”
If I didn’t take the leap of faith and run Windows then I had Word Perfect that ran straight from DOS 5. Word Perfect was a word processor, the precursor to Open Office Writer, or that other paperclip thing. It was an editor for those of us deluded enough to think someone may want what we wrote to be printed, on paper, and read over breakfast with coffee and expensive little pastries. Most of my games also ran like from DOS, Gods anyone ? Now, Word Perfect had a front end, but it was no GUI. By Front End I mean it had a menu bar, with buttons, and windows that popped up to save and load, but what you saw on the screen was not WYSIWYG, it looked nothing like what you would get when you printed it on paper. It also had a macro key feature, which if you could do the Rubik's Cube in less than a minute was easy to master. Unfortunately I couldn’t do the Rubik Cube at all, and still can’t now, although I did buy the book that was supposed to teach me in less than a week — I finally called it a fail after 6 months. With macros, you could type a combination of keys and do amazingly complex things, without even thinking about that white monster over there in the corner of your terrified eye.
Like most humans I am lazy, and slightly deluded about how clever I am. And so eventually all my time was spent in Windows, clicking on easy to read words, or generic icons (which are much cheaper to use in your APPs, as you don’t need an expensive translator and polyglots etc.). I was a mouse addict. In those days Windows crashed quite a bit, and quite often, and if you also had a hard drive, you’d spend a lot of time formatting it and trying again. Forget BSOD. Death ? You’d be lucky if it was even born in the first place. As most games were in DOS, you would also need to configure the PC with Expanded and Extended memory parameters that would break Windows start up, so there was a lot of fiddling around with autoexec.bat, and config.sys. Looks at those max 8 character files names, they were good enough in my day !
I felt the world had moved on, GUI was driving, and I was on the bullet train to the future. Soon games were moving from keyboard only, to point and click, Monkey Island spit, spit kerching ! I was 100% in the Windows zone now.
Now, this was also the year I got to university. Things started off nicely. Turbo Pascal had an IDE and so did Borland C/C++. Now an IDE or integrated development environment does it all. It’s the Elon Musk of the development world, although slightly more reliable, and better looking. It has an editor, toolchain, terminal, debugger, with countless open views you can overload your senses with, like a puppy dog in a Diet Coke Advert.
After I got to my final year in 1993, I had to choose a final project, something cutting edge, my chance to put my name on a Peace Prize. I chose the subject of Optical Character Recognition (cutting edge at the time — I know funny eh ?). OCR took scanned images of typed text and converted them to text files literally. Now they were searchable, indexable and took up a relatively small storage space. Supervising my final project was the Dean of the Faculty, the big dog. With him sitting next to me, nobody was going to grill me too much in my Viva Voce. This is where you must present your project verbally, and a panel of lecturers tear strips off your laughable attempt to enter their world, the world of the Dedicated Expert Researcher, the mythical Computer Scientist. Why there goes one now, look, running through the misty mountains, a rare one, it’s bearded I think, there it goes, trying to find that long lost holy grail, a working AI algorithm.
Anyway, the day I went in to learn what on Earth OCR actually was, and “how to do it”, i.e. solve the problem in the 8 weeks of time I had, he handed me login details to the “Lab”. “Holy Cow !”, I gasped the secret “Lab”. On that same piece of faded yellow printer paper, with the parallel green lines crossing, right under my new username mob1, and password !*&^^a, was those two little letters….VI. Nowadays VI has been superseded by VIM, nah I say, improved ! A natural progression, with an equally obvious name improvement. Our lab had countless pretty dumb terminals all connected to some crazy mainframe type thing, running Unix. “This must have some pretty good up-to-date tech” I said to myself as I pulled up an unconfigurable back breaking, non ergonomic chair. “Right let’s login, and get OCR done.”.
Now, as you can guess, username, password, wait. “Hold on” this is well slow. “Heh lab technician, where’s Windows ?”, “Hahahaha, that’s pretty good. Why don’t you type it in and run it”. Oh how dumb could I be, of course…
command not found
“Nope”, hold on, what’s written on this other bit of paper he gave me ?”, there it was, in faded blue ink, “Idiot’s Guide to VI”. It took me a few minutes, but it hit me like a freight train, it was a huge step backwards. I had to use the keyboard !
“Leader ? Escape first before typing ? What on earth, no WYSIWYG, wow what is going on ?”, “Why would anybody in 1993 use this absolute pitiful attempt at an editor ? Where are all the colours ? Where is the busy cursor ?”, surely there was some mistake.
By the end of 2 months of weeping, late at night, in the corner of the secret “lab”, I finally had 3 C++ files, one was called main.c, and the other two were called OCR.cpp and OCR.h. These were both very large. “Encapsulate the world !”, they said, and I did. “Awesome”.
But sarcasm aside, it really was awesome. Being forced to learn the basics of VI just to get by, and also learning to use a command line toolchain, felt like a pretty big accomplishment. I leapt up, punched the air with Gusto, and soon my OCR project was being thrown in the burning abyss of yesterday, the library dissertation section.
Now I was off to the big wide world, a little more cool with my VI knowledge, but I felt pretty sure I wouldn’t need it.
First job — GEC Plessey Telecoms (in the telecoms bubble), 7 years of writing a Multiplexor Management System, used to mange an entire countries telecoms infrastructure. Each computing node had multiple processors, running in HP UNIX. And the editor ? You guessed it VI. Yes HP-UX has a X Windows (motif toolkit), but the tool chain had no IDE, and the graphical editor didn’t support indentation.
Since that first job, I have worked writing software in many industries, including Video Games where I was programming game engines, game code, backend web services — all in C++ and C# on Windows, ergo all using the mighty Visual Studio IDE. So sadly no VIM.
After this I switched to writing Java apps and games on Android, using AndroidIDE, again no VIM.
I have also written a lot of scripts and system tests using Python, and often found myself using PyCharm, or PyDev with Eclipse. One thing I always noticed when sneaking around the back alleys of Preferences, or Options, most applications had a switch to VIM keys or VIM mode for their editors, and this includes all IDEs from AndroidIDE, PyCharm, VS Code etc.
Recently however, I switched to writing embedded firmware for a living. Now, most embedded devices do not run an x86 based CPU. These are too heavy on the gas. Price and Power dictate cheaper and less energy demanding CPU cores. These CPUs are made by companies like ARM (Cortex), Cadence (Xtensa), and a whole host of others (soon we will be dominated by RISC V). With most of these processors, you are developing on Windows or Linux, and cross compiling with their toolchains. These toolchains are based on GCC and now CLANG, and mostly do not have an associated IDE. You could though, if you could handle a little IDE config, setup any toolchain with a general IDE like Eclipse. But quite often that is complex, and for things like debugging is a bit hit and miss. Hardware breakpoints, memory content viewers, even viewing variable contents in the watch window, you’re lucky if it all works as expected. And so, with no IDE, and from peer pressure you end up lost and broke, back on the command line.
Now, I feel really glad that I spent some of my formative years learning an editor like VIM, as it can be used pretty much anywhere, and with any tool chain. Yes it runs from the command line, but in Windows we now have the Omnipotent Windows Terminal (see here for how to use one window for all your python environments, MSYS, Ubuntu bash for Windows Linux Subsystem, Git Bash, Powershell, Cmd, SSH, the list goes on !). Becoming too reliant on a huge, licensed IDE, can be a big mistake. They are the Rolls Royce of the programming tools world. But sometimes the client we chauffeur around doesn’t want to spend money on such a big shiny beautiful vehicle, they want us to know how to drive a Mini Metro. It might not go as fast, but it’s easier to park if you know how, right ?
But there is one more thing to mention, connecting to a machine remotely. Recently at one big multinational company, I would often connect to different SSD Test Clients. Writing SSD firmware we used a Windows dev PC, and a mix of linux and Windows test host PCs. These had one of our NVMe PCIe 4 SSDs plugged into it for debugging if a test failed. At the start of my time at the company we used VNC, or remote desktop to connect. Super easy, and I could run notepad++ or an IDE, or whatever I wanted to, as I had an OS that could display GUI remotely connected to my development desktop. But, as these hosts were logged into an anonymous account, everyone could access them, and so all of a sudden this was considered a security risk. We then were forced to use SSH to connect to these hosts, and heh presto no OS with a GUI anymore ! Can’t popup notepad++ etc. change the code, build it locally etc. So, back to editing local files on the host via, you guessed it VIM !
You see VIM runs in the same window you are already using, inside a terminal. It doesn’t need to pop up another window or use any display widgets, you don’t need an Xwindows system running on the host, or a remote visual OS view. One great related feature to this, is the ability to use vim over ssh. Here’s a single command line that allows you to ssh to a machine, edit a local file, before it gets copied back to the remote machine via rsync.
user@host: vim rsync://server:/etc/hosts
So starting with my 286 running in DOS, and learning VI right at the end of university, then using it on and off during my career, and now finding myself using it even today, I can guarantee it’s worth learning.
I haven’t even touched on the features and functionality, as others are better suited than me to do that. Yes, I can use the .vimrc file, and I remember about 50 shortcut keys, but that’s it for me, “I’m no VIM King”, Mr Robot. You can often find me taking notes from the “8 things everyone should know about VIM on day one” articles. I use VIM daily on my shiny new PC, and this isn’t a 286 (sadly), it’s a liquid cooled AMD Zen 3 5950, 64GB DDR, 8TB of NVMe PCIe 4 SSDs, and a 3090 RTX, and what do I use to edit my code ? VIM. Either through the Visual Studio Code VIM plugin, or straight from the command line itself, in WSL2, git bash, or even a cmd shell.
And so the moral of the tale is this, don’t be the super quick hare racing off to grab the golden fruit from the highest mountain of the kingdom ruled by the King with no eyes. Or to put it another way, learn VIM while you have time, not when you have to, stop worrying and learn to start loving the VIM.