Among the holy wars The most legendary of which we are aware is the publisher war. Vi / Vim against Emacs. This is particularly fun because they are both free software with very high capabilities.
This goes back many years. Emacs was developed by Richard Stallman in the 35s, released approximately 1991 years ago. Vi is about the same age, created by Bill Joy. Vim, on the other hand, is somewhat more recent and arises from the need for Bram Moolenar to create a clone of Vi for Amiga in XNUMX.
How retro! Publishers from the stone age, when life was simpler. And we continue to use them because they evolve and adapt to the times. Vim and Emacs use modern interfaces in GTK, they have their own extension languages, package managers; among other things that put them among the editors Modern.
Table of Contents
What do I use them for?
Let's put a completely hypothetical circumstance. A Gúgol is a mathematical word that defines a one followed by one hundred zeros. How do we write it in a text editor?
The first solution that comes to mind is to type a one and press the 0 key until the column counter sets me to 101, because 101 characters should measure this expression. We're assuming we edit this in a competent text editor, which has a status bar to display these things.
Now, I can think of a simpler solution:
i1 ESC 100a0 ESC
Of course this solution requires Vim, or at least Vi. He command is quite simple, and it is as if we were saying to Vim: Being in normal mode, insert 1 and returns to normal mode. Now insert after the cursor a hundred times 0 and returns to normal mode. Vim will carry out our order without question.
This solution sounds extremely complex, and I get it. First, because we are dealing with the concept of a modal editor. But there are cases where it is much more useful than it sounds.
Let's say we have a shopping list. We are going to go to the store and we want to write what we are going to bring. Remember that it is something hypothetical, nobody should take their computer to the store to go for food. Anyway, this is our list:
1 Banana 4 apples 2 kilos of sugar 1 Liter of water
It is a very simple shopping list. But we are going to make some arrangements. First, I think a few more bananas would not be bad. As we like aesthetics, we will change the lowercase in apples to leave her as Banana and we will replace the names of the units with their abbreviations.
So let's get started. Since we want a backup of our original list, we make a copy with 4yy and we paste it below with p. Press Ctrl-a a couple of times to increase the number of bananas and move to the end of the next word with e. We go down to the second line, we do a Fm to get to the word apples and press ~ (AltGr-4 on my keyboard) so that the letter changes to its uppercase version. We make a j to go down to the next line and we appear in the k of kilos with b. We exit the normal mode by typing cw and writing the replacement word for kilos, which will be kg. We press ESC, returning to normal mode and again j to do the same with Liter. Ready. This is what our list looks like now.
3 Bananas 4 Apples 2 kg of sugar 1 L of water
Let's summarize the previous action in this:
4yy G p 2Ctrl-A e Fm ~ jb cw kg ESC jb cw L ESC
I have respected some spaces to make it understandable, but it is not usually done. This order of a robot makes us think a lot about its usefulness. But it sure is faster to do this than to move with the mouse, select, copy, paste, delete and so on.
Editors as long as Vim or Emacs can do things like this because they have been developed for years and with very clear ideas of how to do things.
Yes, they are steep. But that's what initiatives like Cream are for, which provides a completely ready-to-use Vim environment right out of the box without having to struggle with modes and that, and guru-mode, an Emacs extension that - as far as I know - helps beginners.
The guru-mode is part of Emacs Prelude, a collection of extensions what make it easy for you if you want to learn.
Since they are more widespread editors than many modern editors and have their own extension languages, you can find color themes, plugins and more. There are such interesting things out there like:
- Un personal organizer (Emacs)
- Un wiki inside editor (Vim)
- Ways to make you nucleoside, coffee y tweet/dig (Emacs)
- And even a full distribution to make life simpler for programmers (Vim)
It seems that it is easier (or more pleasant) to program extensions in Emacs Lisp than in VimScript. I mean, it's a functional language interpreted by a kernel made for that, against an imperative language made to configure and extend.
Take a look! It costs you nothing, both are free software distributed for free. They must be in the repositories of all the distributions known to man and can even be found in malefic proprietary systems. There is not much more to ask for.
And finally, if you were surprised why I put an e before Emacs in the title instead of a y, it is because it sounds better to me. Something like / í-macs /. I was able to save myself spelling problems by changing the position, but I really like Vim to do that to it 😀