Last night I was scouring through the internet and came across a curious post on Reddit from 4 years ago.
The user Astr0Jesus was asking the following question:
Can someone explain to me why people use vi/vim? I've found them to be extremely annoying and nano has been simply a better tool in my experience. I'm not very knowledgeable of this stuff though so I'd like to know if I'm missing anything.
I was interested.
Because this is a questions that gets asked so many times I decided to compile the best answers from this thread and keep them here so we can reference this article in the future when someone get curious about why Vim.
So without further ado:
If you spend many hours per day editing text files (e.g. programming), then it can be worth the effort of learning an advanced text editor. Vim controls look strange to start with but there is a logic to them where you combine movements and actions, so eventually they make a lot of sense. Once you are familiar you can do things quicker than in other editors (and without having to take you hands off the keyboard). Add in scripting and customization and you find it hard to understand how you managed without it.
So if you only poke a config file occasionally, then its probably not worth the effort to learn vim. But if you are a developer and like to learn things, then its worth a try.
PinkyThePig continues on the same line as the above answer, but adds some practical examples:
vi/vim, once you get over the initial learning curve, is far far better for editing things like config files, programs etc.
In nano, what do you do when you want to delete an entire line from a config file? Probably arrow key down to it and then hold delete until the whole line is gone.
In vi/vim, I can scroll to it with 10j (10 lines down), then press dd to delete the entire line.
vi/vim is also installed everywhere whereas nano may or may not be there. When you work for large businesses, getting approval to install another package may take days to go through a change control process.
Finally, learning vi/vim isn't actually terribly hard. Set aside an hour or so some day and run vimtutor. vimtutor will take ~30 minutes, the rest of the time you can spend in various files trying out combinations. After you get used to it, you'll see why people like it.
Kok_Nikol gives a little bit more inside into vimtutor:
+1 for vimtutor, it's already on your system, and it teaches you trough examples (you edit a large text file with vim) and it takes about 30 min to finish (more if you want to practice)
I got really used to the navigating and line manipulation commands.
The user butthackerz also delves into practical examples to show how powerful Vim can be:
People like Vi because its design philosophy echos that of Unix. In both Unix and in Vi, you have a collection of atomic commands performs one task. More complicated tasks are done by combining the smaller predefined tasks.
For example, the Vi command dl deletes the next character, dw deletes the next word, and db deletes the previous word. Here, d represents the delete operator and must be followed by a movement task. l means move to the next character. w for the next word and b for the previous word. d2b will delete the previous 2 words. dtx will delete every character up to the next x in the current line.
fluorihammastahna keeps it pretty simple and direct:
Nano is intuitive, vim is powerful.
erveek taps into one of the main appeals of VIm, it's community:
It's a powerful text editor that has a fanbase. The fanbase is my favorite feature of vi/vim. It ensures that no matter what platform I manage to wander into, some form of vi will already be available.
Don't have to learn a new set of quirks for every text editor. Just learn one monumental set of quirks and be done with it.
dnstunnel_and_vpn goes deep into the more obscure Vim capabilities:
In vim, all your edits are saved, and you can load past revisions easily. I once made a couple of changes to a config file, and deleting them didn't fix the problem, so I just looked through the list of previous versions, and picked the one that worked 15 mins ago. Not sure if nano has that, but also vim is on every Linux system I've ever had to use.
Finally, the user liberulo also leaves his opinion:
If you didn't try to learn vim, you're missing the world. It's an extremely powerful text editor. Editors like nano are like Fisher Price editors in contrast.
As we can see, there are more than enough reasons for one to learn Vim. But there's also some downsides. I'm leaving them out of this article because this is supposed to be a reference article, but feel free to comment with what is less than ideal in Vim.
So the next someone asks you "Why Vim?" I'm sure you'll have a couple of good reasons to present.
Want to learn more about Vim? Want to learn how to use it as an IDE? Check out my new book An IDE Called Vim. It has everything from basic Vim usage to file finding, auto-completion, file manager and more.
Create your free account to unlock your custom reading experience.