What’s your favorite terminal editor? Vim, Emacs, Micro? How did you get started using it? Why do you like it?
I started using Micro after I installed Garuda for the first time since it is the default editor. I liked it right off the bat because it was so easy to get started–it’s got the same keybindings as a lot of other applications like word processors or web browsers. As time goes on and I learn more about the advanced features it has I like it more and more. It’s so customizable! Pretty much any feature you want can be assigned to any keybinding you want, for example.
I have tried other editors too though, and invested a good deal of time into studying and practicing Vim because it was supposed to be so fast and efficent. Not to go into a long-winded Vim rant or anything, but…oh, what the heck, here’s a long-winded Vim rant:
Vim’s broken promise
I started studying Vim for probably the same reasons as most folks: reading fervent accounts from Vim enthusiasts about how once you learn it, it is so fast and efficient, and you just get into this zen-like workflow where your keystrokes are like movements in a dance, and blah blah blah. Plus, sometimes you’ll read something like this, where the guy is clearly a full-on Vim ninja. I gotta admit, it’s just really impressive for some reason.
Just to clarify before I get into it, I do not think Vim is a bad editor. It’s not terribly difficult to learn if you go through the tutorials and spend time practicing with it, and it has a lot of good features. Still, it doesn’t necessarily seem faster or more efficient than basically any other editor out there for most things, and for a lot of basic things it’s actually terribly unweildy for no reason except that is the way it has always been.
A good example of this is how Vim uses H J K L as the arrow keys. This configuration is kind of Vim’s claim to fame, or at least one of the features that is more well-known to non-Vim folks. Vim enthusiasts will proudly announce this is a great workflow boon because all your arrow key work is right there on the home row instead of…well, on the arrow keys I guess.
But is that such a tremendous benefit? I think the majority of arrow key users would agree that the arrow keys are very easily accessible. Most people probably do not have to look at the keyboard to find them. You just shift your hand over and hit the keys when you need them, same as you would for any other keys that not in the main typing area. I would argue the arrow keys are more accessible than the navigation keys (Home, PgUp, PgDn, etc), the num pad, or the F-keys.
Then, once I started practicing Vim I realized this home row thing was a bunch of bologna because you have to constantly hit the Esc key for changing modes when you are using Vim. That’s just as far away as the arrow keys on most keyboards, so it’s not like we aren’t moving our hands around here.
Where did this H J K L nonsense come from, anyway? Well, turns out it was not some efficiency hack or anything like that. Rather, the author of vi wrote the program on a ADM-3A terminal.
The ADM-3A terminal has the arrow keys on hjkl
:
By the way, on these old ADM-3A terminals Esc was positioned where Tab would be on a modern keyboard:
Esc used to make sense as a key for changing modes, which you need to do constantly when you are using Vim.
H J K L is just an old, clunky way of interacting with the arrow keys that has been carried forward not because it is efficient or practical, but because people have gotten used to it.
I think the straw that broke the camel’s back for me was just what a pain in the neck it is to exit out of Vim. I don’t mean the old “I’ve been using Vim for ten years…because I can’t figure out how to exit the file” joke, I mean the options for quitting out of Vim are just so clumsy and unnecessarily long-winded.
Take for example the simple case of opening a few files to see what is inside, maybe copy a line out or make a quick edit, then close the files down. With the Micro editor, you hit Ctrl+Q and the file closes. This is one keystroke. It can be done with one hand. If the file has been changed it will ask you to save, y
or n
so you will press one more key at the end of the normal binding. Nano is basically the same with a different key.
If I want to exit out of a file with Vim, first of all I may need to hit Esc once or twice depending on what mode I am in. Then, to quit you need to press Shift+:, q, Enter. That’s three keystrokes, plus we need both hands now just to exit out of the file.
But wait, there’s more: if you modified the file at all (even accidentally), the exit command will just fail. Now you need to start over. If you want to exit and discard the changes, you need to change the key sequence: Shift+:, q, Shift+!, Enter. Now we are up to four keystrokes, and quite a back-and-forth on the keyboard as well. If you want to exit and keep the changes you made, you’ll have to use a third key sequence: Shift+:, w, q, Enter.
Maybe it’s just me, but after doing this repeatedly while looking through files it quickly started to feel really tedious and inefficient.
Where is the speed, the efficiency, the zen-like flow I was promised? Putting in my PIN at the ATM is faster than closing out of a file with Vim.
Practice anything long enough…
For many years when I was younger I worked in a supermarket where the cashiers would have to type in a four-digit code for every produce item (carrots, lettuce, pototoes, whatever). There was a code book where they could check what a code was if they didn’t know it, but the experienced cashiers would eventually have all but the most unusual items committed to memory.
Watching some of them work was quite remarkable; their fingers would be flying over the keypad at breakneck speed, while they calmly passed some broccoli or whatever over to the bagging area with their other hand, never looking at the numbers the whole time. It just became muscle memory after a while; they wouldn’t even think about it conciously while they were ringing up the produce.
Their speed and efficiency was not due to the produce codes being logical, easy to type in, or otherwise conducive to an effective workflow. It was due to typing them in over and over all day long. The codes could have been anything at all and eventually, through repetition, they would have learned them and gotten quick and efficient at typing them in.
In this way, I think people certainly can be fast and proficient with their Vim usage after they have practiced long enough. I do not, however, believe this has much to do with Vim itself, but is more the byproduct of extended exposure to a routine. People can get fast and efficient with any editor with enough practice.
Why I think Micro is better
Micro uses common keybindings that everyone already knows from other programs like word processors or web browsers. Ctrl+C to copy, Ctrl+X to cut, Ctrl+V to paste, Ctrl+S to save, and so on. This is a nice feature because you can get started without any studying or practicing required.
Being able to actually use the mouse if you want to is a nice touch as well. You don’t need to use the mouse to get around in Micro, but if you want to you can drag to create a selection, double-click to select by word, or triple-click to select by line. It’s nice to have the option.
Micro has tons of other awesome features too, like multi cursor support, split or tabbed windows, and a fairly robust plugin system. For those interested, I have discussed the advanced features of Micro in more detail in the FAQ/tutorial topic here: Mastering the Micro text editor
My favorite thing about Micro is how customizable it is. You can rebind keybindings or create new ones, or edit the settings of the editor itself on the fly if you’d like. Go ahead a write your own plugin if you have Lua chops, it’s all supported.
What editor do you like?
What’s your favorite editor? Micro? Nano? Vim?
By the way, I hope I have not caused any offense to the Vim community with my long-winded rant; I think each person should use whatever editor they enjoy!
If you are a Vim user, have you tried the very excellent Helix?