Menu

Vim is Better - Here's Why

By Noam Yadgar
#ide #text #editor #developers #programming #vim #neovim #productivity

For non-users, Vim is often perceived as an outdated and cryptic text editor. Its steep learning curve allegedly makes it not worth the time investment, especially when other text editors are much more straightforward. A common claim among programmers is that Vim cannot compete with modern IDEs. In this article, we’ll see if this claim hold truth. We will also challenge the claim that Vim is better than any other text editor and IDE out there.

Can Vim be used as an IDE?

The answer is yes. Neovim is an open-source Vim fork released in 2015 (about 24 years after Vim). It has more than a thousand contributors and primarily focuses on making the software easily extendable. Neovim has a vast ecosystem in which users actively participate in extending functionality. With a simple framework for writing plugins and an unlimited API for custom configurations (thanks to Vim’s design philosophy), Neovim users can enjoy an unopinionated approach to text editors. They don’t have to adopt the software’s mindset but rather bend the software to fit their own.

neovim logo

The original Vim software is still in high demand; even companies like Apple ship it with their OS X. The Vim repository is still alive and active and serves many users who like a more authentic Vim experience.

Neovim evolves faster

Any open-source mega project with a large ecosystem will keep fuelling the engines of progress, and Neovim is no exception. Whenever a new feature request is trending, the community will jump ahead and fulfill it. Neovim has a few technical properties that allow it to be extra responsive to ever-changing user requests

  • Neovim uses Lua , a simple and fast embeddable scripting language. The software is shipped with a built-in vim module that exposes an API that lets users configure Neovim however they want.
  • Writing plugins is relatively easy since it’s no different from writing configurations. The same Lua framework is used for both scenarios. Neovim also has a few popular plugin managers (such as lazy.nvim ) for easily installing plugins.
  • Developers can write plugins that integrate with other plugins. This powerful property creates little ecosystems around popular plugins, where users modify or extend the usability of specific plugins. A good example is the integration of Todo Comments (a plugin for marking and locating TODOs) with Telescope (a popular fuzzy-finder).
  • The fact that Neovim is a terminal app, allows it to run fast and be highly portable. Plugin developers can focus more on usability and functionality and less on system compatibility.

Example

One of the most essential features of an IDE is using the Language Server Protocol (LSP) . This standard protocol is used to communicate with different language servers, allowing many other features, such as auto-completion, goto definition, auto imports, rename/refactoring, linting, and more.

session example

Neovim users have complete control over every LSP component. From how they manage and choose linters, LSP servers, DAP servers (debuggers) and formatters (e.g., Mason ) to what type of suggestions the auto-complete plugin should show. Everything is configurable, programmable, and open-source. Nothing is hidden.

Too much configuration

You may be searching for a catch, so here it is. Open up Vim without configurations and use it just for text and basic file management. You will experience a powerful and capable text editor, but nothing more than that. If you want Vim to do more (i.e., IDE), you must add many configurations, which require much time and learning. For that matter, Vim, as an IDE, won’t be a plug-and-play software.

Configuring every aspect of Neovim to turn it into an IDE can dramatically shift the balance in favor of other IDEs. Most users prefer opinionated software, where they don’t have to make choices for every component they use. What are your options if you’re one of those but like the Vim editing experience?

Neovim distributions

A distribution is a downloadable and maintained set of Neovim configurations. The whole point of distributions is to provide a plug-and-play experience, where a simple installation process turns your Neovim into a fully featured IDE. Using a Neovim distribution is great for those not interested in making and maintaining their configurations.

Neovim distributions are also great for beginners interested in learning how to configure their environment. Distributions are usually transparent, and most (if not all) configurations are visible and open to customization. A couple of great distributions I recommend checking are:

Of course, there are more distributions out there. Many users are also sharing their personal configurations. Looking at and trying other users’ configurations is a great way to learn how to configure and develop a personal taste.

If you want a more minimalistic configuration with a lean on Golang, you can clone my configurations to your ~/.config/ path. (You’ll also need to install ripgrep to support live_grep when searching terms).

Vim is a superior editor

The example above shows the typing process in Neovim (using LSP features). However, the true power of Vim/Neovim is in editing. Most text editors consider editing actions secondary to inserting text; for example, selecting, copying, pasting, and deleting text often requires the Ctrl key and some other key combinations. In Vim, these priorities are opposite.

Vim assumes you spend more time editing existing text than inserting new text (which is probably true). The NORMAL mode of Vim turns every key in your keyboard into a command, allowing you to talk to Vim directly. This direct conversation with the editor is based on muscle memory and experienced Vim users' eyes, fingers, and brains operate in perfect unity, which becomes more challenging if you’re distracted by point-and-click, dropdown menus, and other proxy-like editing actions.

Editing example

In Vim, Let’s go to the following line and follow the instruction:

write"foo" inside the parenthesis (but first remove everything inside).

While in NORMAL mode, we can enter the following key combination:

ci(foo

write "foo" inside the parenthesis (foo).

Looks like that worked, let’s break it down:

  • c - Stands for change. This command conveniently deletes the text that we would like to change, and puts our cursor in INSERT mode, letting us type the new replacement text naturally.

  • i( - Stands for inner (), or “whatever is inside the next set of parenthesis” (relative to the cursor). The change command is expecting a scope (c[selection]), and i( is the provided scope. This combination is not unique to the change command, but a general way to pick the inner content of the next set of parenthesis.

  • foo - When we are typing ci(, we’re saying: “Go to the next set of parenthesis and change its inner content to …”. As mentioned above, the change command puts us in INSERT mode, so after running this command, we can naturally continue typing the replacement text: foo.

It’s like driving a car

The exact property that gives Vim a steep learning curve makes it a superior text editor. Like driving a car, Vim relies heavily on muscle memory and good human-factors engineering. Here are a few considerations to help improve your skills:

Practice touch-typing

If you drive a car, you know your eyes are looking at the road while your limbs operate the vehicle. You have a good perception of the space around you, and your muscle memory lets you fuse your intentions with your physical actions.

Touch-typing is a technique for having complete control over the keyboard without looking at the keys. Mastering this technique is essential to Vim users, as it lets you form a strong connection between your intentions and Vim’s keyboard language. Your eyes will look at the content while your brain sends editing commands to your fingers.

Don’t use the mouse

One beneficial practice is actively avoiding the mouse while using Vim. Although most terminal emulators and Vim/Neovim support using a mouse, Vim shines with keyboard utilization. Getting used to Vim’s keyboard commands will pay off. To strictly avoid using the mouse, you can set the mouse option to an empty string.

In Vim, the mouse is disabled by default. In Neovim, you should add the following line to your lua configurations:

vim.opt.mouse = ""

Or in vimscript:

set mouse =

Have a comfortable typing environment

Having a comfortable sitting/standing environment, a reasonable distance from the screen, and a decent keyboard in a relaxed position can help you achieve a more enjoyable and focused experience. Remember, it’s not just about speed and productivity but also about having fun and a good editing experience.

Summary

Opinions about Vim are usually very polarized. Some say it is one of the best editors, and some say it is one of the worst. The reason is that people who claim Vim to be one of the best editors managed to pass Vim’s steep part of the learning curve, and those who do not share this opinion are usually at a point where Vim’s commands and principles are not making a lot of sense to them.

learning curve

In conclusion, Vim is an extremely powerful text editor that can be extended into a fully featured IDE. It is one of the most unique text editors as it takes a very different approach, centered around natural human behaviors such as muscle memory and eye-hand coordination.

Users often claim that Vim is the best text editor, mainly because they have reached a comfortable place in Vim’s learning curve, where using the software is easy and natural. People familiar with but not using Vim often consider it a bad and complicated software. To enjoy Vim, you must dedicate a fair amount of time to practice, but the reward is amazing.