Blog

Attain expertise that can facilitate growth of your organization.

city

By Kuba Biały | Software Developer

I have been professionally developing software for a long time now, and after years of programming, I realized that one of the things I like the most about the process of actually writing and editing code is finding a way to do it quicker or more effectively. This made me pretty good at using shortcuts in my JetBrains IDE, but I wanted more and because of a small bet with my colleague started using Vim for two weeks. These two weeks ended, and I stayed with Vim for the next two years.

While I don’t think IDE is a bad choice, I think going for Emacs or Vim can be a very good one. Both IDEs, and mentioned text editors, can offer great development experience and make a software engineer much more productive. Where IDE offers a lot of features, Vim/Emacs offer a lot of customizability. As a matter of fact, the most commonly used features such as code intelligence (completion, context, documentation lookup, etc.) or advanced project navigation can be easily set up in both Emacs and Vim as well. 

Here is why I think you might want to give these editors a chance.

What is Vim/NeoVim?

Vim and NeoVim are both text editors that allow you to edit text files inside your terminal. They are both based on the vi editor, which was released in 1976. Both are modal editors, which means that you can edit the text using different modes.

NeoVim is a fork of Vim, and it offers several features that are not available in Vim, including support for writing your config files in Lua, a lightweight, high-level, and multi-paradigm programming language. That gives you the ability to configure it to an even higher extent.

Both Vim and NeoVim, while steep in terms of a learning curve, offer a great experience when it comes to writing and editing code with powerful shortcuts and macros. Out of the box, both are offering many features you would usually expect t to see in a full-fledged IDE such as ease of navigation through the project and code highlighting.

NeoVim has been chosen as the most loved editor for a good reason. Its out-of-the-box support for LSP (language server protocol), ability to configure its behavior with Lua and great community made it a fully customizable tool that reflects the way you want to work without being over, if at all, opinionated about your way of using it.

What is Emacs?

Emacs is a text editor that was created in 1976 for POSIX operating systems and is available on most modern operating systems. In over 40 years of existence, it became loved for its efficient way of solving common yet complex actions, variety of plugins, and long legacy of honing its configuration close to perfection.

Though, similarly to Vim, perceived to be difficult to learn, it is a powerful and extremely hackable editor. Emacs’ extensibility Emacs’ extensibility is its biggest feature. The core of the editor is written in C but most of it is written in Emacs Lisp (Elisp) which is the extension language for the editor. You could think of Emacs more as an Elisp interpreter/platform to develop and run Elips programs, and unlike some other editors, it has full support for its extension language out of the box.

This essentially means you can program your editor to behave the way you want, not the way developers wanted. Emacs’ extensions Emacs extensions can provide you with any tool you might need for the job, probably even beating NeoVim to it.

Why use Vim or Emacs when I have VSC or JetBrains?

I believe you should give Vim or Emacs a chance because both VSC and JetBrains are opinionated tools that assume how you should code and how you should use your toolchain. While IDEs are great, they are also very opinionated. These are heavy GUI applications that provide you with a lot of tools, sometimes with a price paid in performance.

Keyboard-based – just like Starcraft.

Both Vim and Emacs are keyboard-based, and while you technically speaking can use a mouse with either, using just a keyboard means that everything you might ever need from these editors is just a keystroke away from you at any point. This can often keep you in the flow longer because you no longer have to look for your mouse or through the toolbox looking for that one particular thing, you just enter a short combination of characters and there you have it, the way you wanted it.

Be the master in your own home

Emacs and Vim are very rewarding once you get the basics covered, they’re perfect tooling for creating your development environment as opposed to using an integrated one. You can set them up to act as you wish, if you want to run an exact sequence of commands on every save in a very specific project you can set it up in minutes. With a plethora of plugins and equally many configs available on GitHub, you can nurture your internal hacker and tweak these editors until they work for you and against you.

Why are people using Emacs and Vim?

I use them because I enjoy staying in one environment, and in my case, it is a terminal. I have been using the terminal for the majority of work I’m doing, from Git operations to SQL queries, so at some point, it was natural for me to move the coding part to the terminal. As I tweaked my config, it more and more resembled the flow of work I preferred.

Other NeoVim users, who did a lot more to popularize this editor than I did, had this to say when I asked them “why are you using Vim”:

“My short answer is I found out there was a thing that I could write code for and that I would write code in. And it seemed like a cool cycle. So I liked it and started on it, and there was someone at my work who knew Vim well, and I respected them.” – TJ DeVries, NeoVim Core Member

“I started to use Vim because I wanted to try to be faster at editing. I have so often in my life had a bunch of ideas in my head and I needed them to get out of my head and onto paper.

Using Ctrl+shift+Mouse just always had this small nagging feeling of being slow or annoying.

On top of that, I am a huge starcraft fan. That shaped my desire to use Vim.

So when I started to use Vim, I was attempting to fix an annoyance I had while editing text.

It SUCKED at first, but it became awesome at about ~3 weeks into the experiment.” Michael Paulson, The Primagen – Netflix Engineer and CEO of TheStartup.

One of the advanced Emacs users that I got to know had this to say about Emacs:

“I got into Haskell about 5 years ago and at that time Emacs had the best Haskell support (this was before LSP). I stuck with it because of the extensibility. It’s very nice to have this one platform that you can extend to do pretty much anything and integrate with every part of it, same key binds and UI conventions everywhere. Everything from just writing source code to chatting on IRC, mail clients, news reader, etc.

Since it’s lisp you can change anything at runtime and nothing is hidden from you, you have direct access to the guts of Emacs and therefore full control over everything.

Other than programming I do a lot of note-taking in it, with org-mode + org-roam I can have notes with executable source code, inline latex, and links between nodes – it basically merges the capabilities of the Jupyter notebook and the Roam Research into one system.” – Erik Bäckman, Emacs mastermind, Haskell enthusiast.

What’s in it for you?

Great learning experience, an insanely amazing community, and the best part – an editor that’s not trying to be smarter than you. IDEs are great, but there is a whole new world of defining the way you want to build software awaiting you. Give them a go and find for yourself.