10 Reasons to Learn the Vim Editor

Vim is an advanced text editor. The name Vim is a contraction of Vi and Improved. So, Vim is vi improved. I’m not going to bore you with an entire history lesson, but quickly, Vi is a text editor that was originally created for the Unix operating system. Vi is actually short for “visual” and started out as the visual mode for the even older ex line editor. On most modern systems, Vim has replaced vi. Even if you think you’re starting vi by running the vi command, for example, Vim is what actually starts.

So, long story short, Vim is a powerful text editor. As you can probably guess, I’m a huge fan of Vim. I’ve used it almost every single day since the late 1990’s. Now I would like to take the next few minutes and share with you why I absolutely love Vim and why it’s worth your time to learn how to use Vim, too.

1) Vim Is Ubiquitous. (It’s Installed On Every System.)

For starters, Vim is installed practically everywhere. I can’t remember ever logging into a system and not being able to use the Vim editor. Most Linux distributions install it by default. With other editors, such as nano or Emacs, they may or may not be available. If you’re working on a system, and your only editor choice is Vim, then you need to at least be able to use it to make simple edits.

Also, many programs rely on an external editor. By default that external editor is Vim in most cases. Typically this can be overridden by setting an environment variable such as EDITOR. However, if you execute one of these commands and find yourself looking at the Vim editor, you will be happy you at least know how to make simple edits and exit out of Vim. Just a couple of commands that rely on an external editor such as Vim include crontab, visudo, and git.

2) Vim Is Amazingly Powerful.

If you’re used to using nano, then you’re going to be blown away when you start learning just some of the most basic features available to you in Vim. There really is no comparison. Once you start learning Vim, you’ll be more efficient and effective than you ever were with nano.

All the power Vim provides allows you to do things quickly. You can even make complex edits fairly quick and easily, once you know how Vim works. Just some powerful features include macros, registers, command repetition, auto-completion, text objects, searching, filters, and global substitution.

3) Vim’s Commands, Shortcuts, and Key-Bindings Are Transferable to Other Programs.

When you learn how to navigate with Vim, you’ll find you can use those same navigation key bindings in other programs such as man and less. You can even configure your command line shell to use Vim-style line editing features. For example, I use “set -o vi” for my Bash shell, so I can use Vim key bindings to browse my command history and even edit the current command line.

Even outside a command line environment, you can put your Vim knowledge to use. For example, if you have Gmail keyboard shortcuts enabled, you’ll find yourself using Vim commands right in Gmail.

Even other editors support Vim modes. Sometimes the mode is built-in and other times you’ll need to install a plugin first. Here are just a few editors where you can put your Vim knowledge to use: Atom, Eclipse, AbiWord, Kate, Sublime Text, Notepad++, Xcode, and more.

4) Vim Is Cross-Platform.

Keeping with the knowledge transfer theme, Vim is available on a number of different operating systems. Vim is available on Linux, Unix, Mac, OpenVMS, and Windows. Let’s say you want to learn Vim because you use Linux at work all day, but when you get home you use a Mac. Well, no problem. Simply install Vim on your Mac system, and you can use the same text editor at work and at home. And honestly, once you learn how to really use Vim, you’ll want to use it everywhere.

5) You Can Use Vim With a TUI or a GUI.

Not only can you run Vim from the command line and use its textual user interface, you can run Vim in a Graphical User Interface mode suitable for graphical environments. The Graphical User Interface mode of Vim has all the same features you know and love in Vim, in addition to the features you would expect from of a graphical application. Those additional features include things like scroll bars, menus, a list of recently opened files, the ability to use a mouse, and integration with the system clipboard.

6) Vim Has Syntax Highlighting.

Contrary to what some people might think, syntax highlighting is more than just making your files look pretty. The most important thing about syntax highlighting for me is that it makes mistakes easy to spot. If you make an edit to a file, and then the syntax highlighting disappears for that line, take that as a sign you need to check your work.

By the way, Vim includes syntax highlighting for more than just programming languages. If you’re a Linux administrator, then syntax highlighting for the C programming language might not be as useful to you as syntax highlighting for configuration files. By default, Vim includes syntax highlighting for Apache configuration files, DenyHosts files, Gt config files, GRUB config files, ldap.conf, logindefs, named/BIND configuration files, PAM files, Squid config files, SSH configuration files, and sudoers just to name a few.

If there isn’t syntax highlighting available by default for a certain file type you find yourself working with often, you can many times find plugins that provide such highlighting. For example, if you use Ansible for configuration management, you can install an Ansible configuration file syntax highlighting plugin.

Even if you’re not making changes to scripts, source code, or configuration files, having syntax highlighting improves readability and can make files easy to scan.

7) Vim Commands Are Easy to Remember. Really.

Many Vim commands can be easily recalled using simple mnemonics. In my opinion, Vim commands such as “i” for insert, “d” for delete, and “q” for quit are a lot easier to remember than commands like F6 or Ctrl-Alt-Shift-F that other editors use.

8) Vim Is Like a Language.

Once you start to think in Vim, you’ll be able to easily string together commands just like you would string together words in a sentence. Before you can speak, you don’t have to memorize every possible sentence. No, you just use sentence structures and plug in the appropriate words.

Like a language, Vim has the concept of verbs, nouns (or objects), and adjectives. For example, to delete a word you type the command “dw”, which is an action and an object. If you want to perform a different action on that object, then use a different action command. For example, to change the text of a word you would use “cw”.

To delete everything contained within a pair of quotes, you can use the command ‘di”‘. This means “delete inside the quotes.” You have an action: delete, an adjective: inside, and an object: quotation marks.

If you want to delete 3 words, you use the command “d3w” which literally means to “delete 3 words.” It’s very language like.

There’s no need to get hung up on any of these commands at this point. The idea here is to demonstrate how easy it can be to think in Vim, and how it’s actually more efficient than manually learning dozens and dozens of commands for every little situation you might encounter.

9) Vim Is Thoroughly Documented.

I get it. Reading dry, technical documentation is boring. However, once you have a little exposure to Vim, Vim’s built-in help system comes in really handy. You can use it to quickly lookup commands, syntax, and more — all without leaving the editor. You can even edit your file while referring to the documentation all on the same screen. The documentation that comes with Vim is very well written and easy to use.

10) Vim Is Fun.

I love using Vim and once you get the hang of it, you’re going to love it, too. With Vim, there is usually more than one way to accomplish the same task, so it can be fun to use your creativity when making edits. You can even make a game out of it by thinking how you can accomplish a given task with the fewest amount of keystrokes.

Even if you’re not intentionally trying to make Vim fun, it can really be a joy to use. One of the main reasons I love Vim is because it is so powerful and efficient. Getting some serious work done quickly is usually enough fun for me!

Jason

P.S. If you’re looking to level-up your Vim skills, check out my Vim Masterclass course.