If you want to turn a polite conversion into a heated debate then start talking about religion, politics, or text editors.
Yes, you heard me right. Text editors.
Without trying to rekindle the editor wars, let’s look at when you might consider using nano, emacs, or vim.
Nano
Nano is without a doubt the simplest, least complicated, and least powerful of the three editors. The great thing about nano is that it really doesn’t have much of a learning curve. Anytime you’re using nano you’ll see a list of all the commands you’ll need at the bottom of your screen.
You don’t have to remember any commands ever. Just know that the caret symbol “^” represents the control key. So ^X is actually Ctrl-X and it exits nano.
When you perform different operations the menu displayed at the bottom of your screen updates with the currently available commands. Also, any prompts that need to be dealt with are displayed at the bottom of the screen as well. For example, if you try to exit nano and have unsaved changes, you’ll be prompted to save them with a Yes/No question.
Nano Pros:
- No learning curve.
- Easy to use. Idiot-proof.
- Good for simple edits.
Nano Cons:
- Making complicated edits can be difficult and time-consuming.
- No powerful features such as macros, viewing multiple files at once, window splitting, vertical block/rectangle selecting/editing, auto-completion, etc.
Who Nano Is For:
Nano is great for people who are new to the command line or for anyone who needs to make a very simple edit. If you’re a casual Linux user or hobbyist, nano might be all you ever need.
Emacs
Emacs is a text editor, but it’s so much more than that. It comes with a built-in web browser, IRC client, calculator, and even Tetris. See for yourself:
Emacs has a keyboard shortcut for absolutely everything. The good thing about that is you can often stay in your normal typing position which makes you fairly efficient. The downside of that is you end up having to remember a lot of shortcuts with various combinations using multiple modifier keys. For example, the shortcut to quit Emacs is C-x C-c
. That means you’ll hold down the control key, type x
, then type c
.
One of the areas where Emacs really shines is its ability to be fully customized. If you find yourself wanting to do something the authors didn’t think of, you can implement it yourself using Emacs Lisp. Of course, you have to know or learn Lisp to do it, but it’s at least possible.
Emacs Pros:
- Customizable and extensible.
- Powerful editing capabilities.
- Mature integration with many free software programming tools.
- You never need to leave it because you can edit files, browse the web, and so on.
Emacs Cons:
- Questionable ergonomics. (AKA: Emacs Pinky Syndrome.)
- If you want to customize Emacs you’ll need to learn Emacs Lisp which introduces a whole new learning curve.
- Not available everywhere by default. If you need to edit files on a system that you don’t have root access to and emacs isn’t installed, then you’ll end up using vim. Lack of emacs availability is common for server installations.
Who Emacs Is For:
Emacs is for people who want more than just a text editor as Emacs can be an “environment.” It’s also for people who have a strong desire or need to customize.
Vim
I’m a huge fan of the “make each program do one thing well” philosophy.
As we’ve already covered, Emacs is not only a text editor, it’s also an IRC client, a game console, and a web browser. You could argue that the one thing Emacs does well is editing text, but it’s definitely not my go-to choice for a web browser.
Nano does one thing, but not very well. When I say “not very well” I mean that it has limited functionality as a text editor.
That leaves Vim. It adheres to the “do one thing and do it well” philosophy because the one thing it does extremely well is editing text. If you’re a sysadmin, a programmer, or anyone who needs to do serious text editing, then vim could be the next (and last) editor you’ll ever need to learn.
Once you have a handle on vim you’ll be super fast and efficient. If you’re going to work regularly at the command line, learning this powerhouse editor is a worthwhile investment.
With the ability to edit and view multiple files at once, create macros, perform global substitutions and more, you’ll look like a genius when you click a couple of buttons on your keyboard and great swaths of text fall into place just like you want.
Even if you’re not into being as productive as you can be, you still need to learn the basics of vim because sooner or later you’ll end up using it whether you like it or not. Vim is the default editor for the overwhelming majority of Linux distributions. This means you’ll find yourself using vim with programs that do not include their own built-in editor such as crontab, visudo, git, etc.
Also, because many server installations only include what is necessary to perform their primary function, you often won’t find emacs installed by default. With sysadmin tools relying on vim and the lack of other text editors, knowing vim is a must. Said another way, if you are or ever want to be a Linux system administration you HAVE to know vim.
Vim Pros:
- Vim serves one and only one purpose; to efficiently edit text.
- It’s astoundingly powerful. Making complicated edits can be quick and easy.
- You can unlock unparalleled efficiency and speed with powerful features such as multiple file/window support, keyboard shortcuts for everything, macros, registers, quick command repetition, auto-completion, text objects, filters, and global substitutions.
Vim Cons:
- The learning curve often scares away new users.
- If you don’t know what you’re doing you’ll look like an idiot. (“How do I exit out of Vim?!?!?!”)
- If you only ever need to perform super simple edits, Vim can be overkill.
Who Vim Is For:
Vim is a must for Linux system administrators. It’s also great for programmers because coding is mainly editing plain text files which Vim excels at. It’s also ideal for anyone who works on the command line often or has to log into Linux servers. Really, Vim is for those who work with textual data of any type.
If you’re looking to develop ninja-like Vim skills, check out the Vim Masterclass course. It’s the fastest way to learn the most advanced features of Vim.