VSCode to Emacs - the Beginning: Why?

Raghav Awasthi - 1st year CS

VSCode to Emacs - the Beginning: Why?

Raghav's articles

Introduction

Do you think that programmers in movies look far cooler than you do while coding? Are you tired of constantly switching between mouse and keyboard? Or do you simply want to code in a less resource-heavy environment? In a world of IDEs such as Visual Studio Code, PyCharm, and Atom, all of which have extensions for almost everything a developer could ever want, this is a brief explanation (and justification for the countless hours I have wasted over the past month) of why I switched to Emacs (and slowly descended into madness).

What is Emacs?

Overview

Emacs is a free, 47-year old (as of 2023) text editor designed for POSIX Operating Systems which is also able to act as a mail client, integrate with debuggers and interpreters, and run games, amongst many other things. It has so many features to the extent that some people consider Emacs to be an Operating System itself - almost all work can be done from within it.

The most prevalent version, GNU Emacs, started developing in 1985, and because it is open-source, there is extensive documentation about how to use it, along with many, MANY external packages/configurations.

For more information about Emacs, I recommend checking out the following websites:

GNU Emacs - Guided Tour - GNU Project

What is Emacs?

Flavors

GNU Emacs can be divided into Flavors, which are essentially just different configurations that are setup in advanced for new users to get started with. The ones that I have heard most about are spacemacs, doom emacs, and emacs prelude. I decided to dabble in each of the three for about half a week each, but I eventually ended up just going with vanilla emacs, straight through the terminal (I use iTerm 2 as my default terminal on mac, so I spent a long time trying to configure the modifier keys). I may write a few blogs in the future about my own configuration for emacs, as well as the basics about each of the three flavors in the future, but until then, here are the GitHub links to them:

You can also find out more about the different Emacs flavors at the Emacs Wiki.

What was wrong with VSCode?

Before anything else, this is a disclaimer that I am in no way an expert on either VSCode or Emacs. I am just a developer who started using Emacs recently and wants to make people aware of other editing software. Everything here is just my opinion based on my personal experience as a programmer.

Simply put: there is nothing wrong with VSCode. It supports hundreds of languages, has thousands of different extensions, each of which a developer can choose to customize to their liking, and makes the entire coding process much quicker, especially when debugging. In fact, VSCode has an Emacs extension that allows someone to use Emacs keybindings!

Having said that, there is a very tiny gap in the Emacs extension which really annoyed me, namely to do with multi-line editing being slow.

Why did I start using Emacs?

Performance

The main reason that I started using Emacs was because of how processor-intensive VSCode was, and I had read about being able to optimize my workflow and general speed by using Emacs.

Faster + more efficient development

Also, I figured that if there is a way to boost my efficiency by only using the keyboard and not a mouse, I might as well try it. I already made the switch from a QWERTY keyboard to a DVORAK one about a year and a half ago in order to move my fingers around the keyboard less, so it isn’t exactly out of character for me.

Customizability

Emacs is also known for its customizability - using Elisp (Emacs Lisp), I could create and add my own features for my personal configuration, which was a really appealing idea for me. It really hit home when I realized that I could do everything within Emacs - use it as a browser, listen to music, play games, etc.

Features

There are many features that VSCode simply does not have. My favorite software by far is Emacs’ Org mode. In essence, it is an authoring tool and a TODO list manager, but it is incredibly powerful, and I have been using it religiously since switching to Emacs. This website has the latest information about what Org mode is, what it does, and how to use it.

Magit, which is a git tool, is also a very handy package in Emacs. It has all the possible git functionalities a developer could want, and it allows all git commands to be done through keybindings - I much prefer this to the usual terminal commands, e.g.

git add .
git commit -m “”
git push origin main

Of course, I had to save the best reason for last - Mark Handley. He has been using Emacs since day 1 of our lectures with him, and if he uses it, it must be good! Also, my programming tutor uses it, and he looked really cool doing so, so I wanted to try it out 😅

Having said all this, I still use VSCode occasionally - I much prefer Python projects from within VSCode for prototyping in ML. This may change in the future once I get more used to Emacs, of course.

Side-note: I read about using Vim as well, which is faster and easier to learn, but I wanted to challenge myself - I figured that if there is a steeper learning curve, surely the final outcome would be better, right? For a better explanation, have a quick read of this. Also, I briefly mentioned it earlier, but doom emacs is a very good starting point if you want to use some Vi key-bindings with Emacs.

Why should you start using Emacs?

Though Emacs is notorious for having lots of cryptic key-bindings, it only took me a few weeks to get used to the basics, and, as there always are with long-running projects, there is extensive documentation and guides on how to use it. Below is a cheat sheet which helped me a lot while starting.

Apart from the reasons already mentioned from why I switched to Emacs, there are many more.

Though I mentioned customizability above, it is worth noting that almost everything in Emacs can be confiugred to one’s own liking - whether that’s using custom keybindings, or even using specific themes or packages depending on the type of file being edited.

Additionally, Emacs has both a GUI mode and a terminal mode, meaning that the user can choose and switch between Emacs acting as a separate application, or as an integrated editor. This is particularly useful as it allows a user to separately choose how to work, depending on what they will be doing. For example, when I just want to edit some code and run it, I use terminal mode, but if I want to edit some LaTeX document and then view the PDF on the side, I use the GUI mode (although this may just be for my configuration, as Emacs doesn’t support the image output used by iTerm2, which is my default terminal). In general, GUI mode is always better when dealing with different formats, and not just text or text-like files.

Emacs also has many other out-of-the-box features that help with running separate processes and commands at the same time, such as tiling and creating multiple windows and panes within the same instance (think something like tmux).

Finally, Emacs is lightweight and can run on almost any system, making it a reliable choice, especially for older hardware.

How to Transition from VSCode to Emacs?

Though I will write a new blog about this soon, there are many resources online. I would suggest looking at YouTube tutorials, online forums, and other blogs too! Firstly, look at the basics of opening, editing, and saving files, and from there, you can start looking at MELPA (an Emacs package manager) and Elisp to start configuring things as per your preferences. Here are a few links to help you get started:

The Mastering Emacs book

Practical Emacs Tutorial

Quick start

Emacs Beginner's HOWTO: Introduction

There is also always the option simply install one of the emacs flavors from the above section, and then follow the default guide built into emacs by typing emacs into the terminal, and then navigate to the Emacs Tutorial using the arrow keys on the keyboard, and finally hitting RET on the keyboard (return/enter).

Conclusion

I would recommend researching a bit more yourself too, to find out more of the niche features of Emacs (or Vim 🤢) that may be more suitable for you, but if not, I have covered the most important points in this blog. No matter which editor you choose to use, at the end of the day it comes down to whatever you find most comfortable and what is best-suited to your needs.

Of course, Emacs is superior in my eyes :)

Thanks for reading (unless you decided to switch to Vim)!