Skip to main content

5 features that will make you fall in love with Emacs

Good news: You can also implement these features in Vim, Atom, VS Code, or another text editor of choice.
Image
Keyboard with a heart on a key

Image by athree via Pixabay

I love a good text editor, and I was an aimless sometimes-Vim sometimes-Kate sometimes-Gedit user until I fell solidly into Emacs, thanks to a very wise boss who wanted to standardize tools within his team. I didn't intend to become a user of Emacs exclusively, but every time I used a different editor, I found myself missing an Emacs feature.

That's how text editors get you, though: You develop a subtle familiarity with an editor such that the "work" of translating thought—whether it's a network design idea, a specific configuration, or a Bash script—into text feels so natural that sometimes you have to type your thoughts just to make sense of them.

At some point, I accepted that I was an Emacs user, but I like a diverse toolset; I like alternatives and options. That's one reason I use open source! Emacs has a few key features that I consider essential, not necessarily in implementation but in concept. Here are five great text editor features I learned from Emacs and strive to implement, one way or another, in any text editor I use.

1. Plugins and package management

Emacs has lots of plugins, and it's hard to imagine using a text editor that doesn't have user-contributed extensions. In simpler times, you could download an elisp file (or copy and paste it from the internet) and stash it away in your .emacs.d folder for years. However, development tends to be pretty fast-paced these days, and so Emacs also has a package command that lets you browse, install, and update plugins from within Emacs.

[ Download a free Emacs cheat sheet. ]

Not all text editors have plugins, and not all of them need plugins. Sometimes the only feature you want in a text editor is simplicity. However, for a text editor you use for hours at a time, plugins add important customizations and optimizations.

Apply it to other editors

Text editors like Atom and VS Code integrate package management in a similar way as Emacs does. There's a dedicated interface for package browsing and maintenance.

Image
Atom packages
Seth Kenlon (CC BY-SA 4.0)

As of version 8, Vim has an official plugin structure based around the ~/.vim/pack/vendor/start directory. Install plugins there, and they're easy to find, maintain, and use.

Some editors don't have plugins, and that can be considered a feature. Heck, neither Emacs nor Vim had packages when they were starting out, either. But most great editors have rich configuration options, and config hacks are essentially what most plugins start out as. When using a simple editor, I tend to manage my config files so that I can optimize the way I work and replicate that experience in that editor regardless of what machine I'm using.

2. Integration

A good text editor, in my opinion, ought to feel less like an application and more like a part of your operating system. I want my editor to be fully aware that it's running on Linux; I want it to take me $HOME rather than to whatever it thinks is equivalent to My Documents; I want it to know that I'm in a Git repository and what branch I've checked out; I want it to not only invoke shell commands but the whole shell itself.

[ Getting started? Read A beginner’s guide to text editing with Emacs. ]

On Emacs, I can open an elisp shell with M-x shell or any terminal with M-x term, I can split screens with M-x 2 and M-x 3, I see everything in its Git context, I can interact with my filesystem with dired, and so on. There's very little separation between Emacs and everything else I do. Indeed, there's rarely a reason for me to leave Emacs when I need to run a quick command on localhost, or even take a quick glance at an email or PDF.

Apply it to other editors

Many editors have integration features similar to Emacs. There are features and extensions for Vim, Atom, VS Code, Kate, and many others that make the editor fit neatly into the rest of your system. The trick is to take advantage of them.

It took me years to realize that Emacs has a file manager built into it. The muscle memory to Alt+Tab out my desktop was strong, but eventually, the workload involved in leaving Emacs became too costly, and I found myself defaulting to dired.

My hands never left my keyboard, I discovered new keyboard shortcuts (it turns out that just + to add a directory is a lot quicker and easier to remember than dired-directory-create), and my workflow was permanently simplified.

No matter what editor you're using, find that shortcut. Find the small integrations offered by your editor and put them to good use. The features don't add anything to your life if you ignore them, so make them work for you.

3. Tramp mode and remote editing

The tramp command within Emacs enables you to edit a file on a remote system.

C-x C-f /ssh:seth@10.0.1.100:~/example.txt

In terms of your experience, there's almost no separation between the local host and the remote host. It's a subtle and nearly transparent way to edit files without leaving Emacs or your favorite computer.

Apply it to other editors

If your editor doesn't have a remote-editing feature, your desktop might. I don't use Emacs for literally everything, so I really appreciate GNOME's Other Locations feature. To use it, open Files on GNOME and click Other Locations in the left-hand panel. Type in the protocol you want to use (such as ssh:), your username, and the destination hostname in the Connect to Server text field at the bottom of the window, and click Connect.

Image
Remote directories displayed as if local
Seth Kenlon (CC BY-SA 4.0)

It's an embarrassingly simple way to, more or less, corral lots of different systems into an apparently single filesystem.

4. Syntax and linters

I once wrote an article called 10 YAML tips for people who hate YAML, and the zeroeth tip on the list was make your editor do the work.

Image
List of resources
Seth Kenlon (CC BY-SA 4.0)

My point then, as now, is that a great editor ought to help you. While Emacs (no, not even M-x doctor) can't tell me how to best write my next Ansible play, it can tell me that I've tried to put a sequence where a mapping should go in YAML, or that I've not indented my Python code, or that I've forgotten to close an XML tag.

Emacs has "modes," many of which are essentially plugins to help you follow some predefined structure. There's yaml-mode, nxml-mode, and markdown-mode, plus modes for Python, Perl, Bash, Makefiles, and many, many more.

Apply it to other editors

A great text editor probably has syntax highlighting, at minimum. Use it. If your editor has an integrated linter, activate it. I don't rely on my editor to ensure my configurations or code are valid, but I do allow it to point out obvious mistakes to me.

[ Download a free Bash shell scripting cheat sheet. ]

If your editor doesn't have these features, then you should at least implement a reliable check after you've saved your work. This takes discipline (or just a Git hook, if you're lucky), but it's better than discovering the error in production.

5. Keyboard shortcuts

I'll admit it, the real reason I use Emacs is that I'm used to the key bindings. If I open an application that doesn't let me Alt+B or Alt+F to go back and forward a word, or Alt+D to delete a word, or Ctrl+X+I to insert a file at my cursor position, I feel like I'm plodding along with stone-age tools (who uses arrow keys or a mouse anymore?).

Apply it to other editors

There's no accounting for taste, and Emacs key bindings are admittedly an acquired one. I remember finding Emacs shortcuts clunky and cumbersome compared to Vim, and in fact, I used Emacs exclusively as a GUI client for years, defaulting to Vim for edits in a terminal. Eventually, though, the key bindings started to take hold, and it's hard for me to walk away from them now.

Learning key bindings can be real work. It takes you more time to look up a key binding you don't know than it takes just to find the function in a menu you remember. Download a cheat sheet for your editor of choice, or make one on a pad of paper as you go. Invest the time in learning shortcuts now, and it'll pay dividends for years to come.

Love your editor

Here's a bonus tip that Emacs taught me: You should really love your text editor.

Some people have an indifference to tooling, a "whatever works" attitude that admittedly makes for less friction but, then again, can lead to a life devoid of passion. I'm not in computing to engage in flame wars like those you hear about in legends of old, but I do love computing. I have requirements that aren't dogmatic but that I recognize as principles that lead to happiness in the long term.

One of them is to use open source, partly because I've been burned too often by non-open platforms and tools. Another is to fall in love with my text editor. If you're like me, you use a text editor almost all day, every day. You should be excited to open your text editor; you should feel forlorn when you don't have access to that text editor, and you should enjoy your time with your text editor. If that text editor is Emacs, that's great. If it's Vim or Nano or Atom or Kate or something else entirely, that's great too. Get to know your text editor, and let it make your job easier and your life better.

Check out these related articles on Enable Sysadmin

Image
vi vs. emacs
The lowly and now middle-aged vi editor is still a favorite among *nix system administrators and remains an essential tool for command-line file creation and editing.
Topics:   Text editors   Software  
Author’s photo

Seth Kenlon

Seth Kenlon is a UNIX geek and free software enthusiast. More about me

On Demand: Red Hat Summit 2021 Virtual Experience

Relive our April event with demos, keynotes, and technical sessions from
experts, all available on demand.

Related Content

OUR BEST CONTENT, DELIVERED TO YOUR INBOX