Skip to main content
Tips

7 Reasons Why Developers Prefer NeoVim Over Vim

NeoVim or Vim? Which one of the two similar editors is better? I think it is NeoVim and I have good reasons to support this claim.

β€” Pratham Patel

Warp Terminal

The Vim editor is a successor to the vi editor found on the original UNIX. As a fork of Vim, Neovim is an editor that aims to improve the quality of life for all developers, better than Vim.

Vim is an excellent choice for experienced sysadmins. However, NeoVim has gathered a significant following among developers.

Wondering why more developers are choosing NeoVim over Vim? As an ardent NeoVim user, I can think of the following reasons.

1: Project maintenance and feature improvements

You might be wondering "With Vim so popular, especially because of the 'I can't quit Vim' memes, Vim would be the go-to choice for users. Why would someone fork Vim and risk wasting development time just so a dozen people use it?"

And that is a valid question. Vim is really popular! But that doesn't mean that the community developing Vim is pleased with the state of the project itself.

There are two existing problems with Vim's current codebase:

  • The lead developer of Vim has not been fostering the development of Vim as a community-friendly project. This argument is backed by features initially added to Neovim like async support, a built-in terminal emulator, and pop-up windows (for showing debug messages and auto-completion suggestions) which were later adopted into Vim due to community "pressure".
  • The Vim codebase is less maintainable compared to Neovim.

2: Code auto-completion (LSP)

LSP or Language Server Protocol is a protocol that defines how an editor communicates with a "language server" to enable options like code highlighting, syntax checking, code completion, inlay hints, type hints, and much more.

No matter how good of a developer you are, getting type hints, error highlighting and more in the editor itself may not make you a better developer. Still, it will undoubtedly reduce your development and/or debugging time.

Neovim ships with out-of-box support for LSP and uses Lua for further configuration. Vim, however, needs an external plugin to achieve this functionality.

3: Support for better plugins

A plugin is something that plugs into an existing thing and adds a new feature to it. In this case, an editor plugin is something that plugs into the editor and provides more functionality.

Vim already has rich plugin support and also an ecosystem, so much so that there are plugin managers just for Vim!

How to Install and Use Vim Plugins
Vim’s functionality can be extended with plugins. Here is how you can install and use plugins in Vim. Also learn about updating and removing the plugins.

But Neovim one-ups Vim by allowing plugins to use a "more versatile language" to write plugins in Lua. Not that Vim's built-in language was bad, but if you want IDE-like functionality, the setup will get complicated. And, with an actual programming language, this configuration is comparatively easier than Vim.

This means that you can extend or modify even core Neovim functionality.

Here is a list of plugins that are exclusively for Neovim because Vim does not offer a similar level of extensibility.

4: Parallel start up

I discussed above that Neovim uses Lua as an optional but additional language for plugin configuration. But did you know that Neovim starts each plugin in parallel?

This ought to make you feel even faster with Neovim, especially if you have plugins that take a few seconds to initialize!

5: Ability to embed the editor

Due to the codebase of the Neovim editor being comparatively easier to maintain than Vim, the possibility to embed the core editor into something else becomes a real possibility.

You can finally have a good editor in VS Code now 😎

6: Location of config file(s)

Having used Vim, when I needed to distro hop migrate to a new different Linux distribution, I would usually forget to take the backup of the ~/.vimrc file because it was not in my ~/.config directory.

Most of the modern Linux applications adhere to a standard called XDG (Cross Desktop Group). This standard defines various things but one of the most important things, in this case, is the location from where the application loads its config file(s).

This standard dictates that user-specific config files should be stored inside the ~/.config directory. Neovim adheres to this and the primary config file (init.nvim) is stored inside the ~/.config/nvim/ directory.

This is a minor nitpick but it weighs in highly when taking a backup of the important files on your computer.

7: Optimizations made in Neovim

Before I talk about optimizations, please note that both editors are fast enough that neither may feel faster than the other in day-to-day tasks. But I feel obliged to share this.

Neovim has several optimizations to how it reacts to user commands. For an example, take the following command:

:g/<pattern>/d

If you execute the above command in Vim, it will find all the lines with your specified regex pattern and delete those lines. That is not all that Vim will do. The d key also copies the deleted text to the register (clipboard).

This means, Vim will do the following:

  1. Find the line with the pattern
  2. Copy it to the register
  3. Delete the line
  4. Go to step 1 if there are other lines with matching pattern

If you do not want Step 2, you can use the following command in Vim:

:g/<pattern>/d _

The above command will do everything but copy the line to the register, speeding up the operation. Suppose you run the previous command (without the underscore) in Neovim. In that case, it will notice that you are trying to delete multiple lines and will use automatically "optimize" it by including the underscore.

Bonus: Better out-of-the-box configuration

This is somewhat of a personal opinion but if you are new to either Vim or Neovim, I would advise you to start your journey with Neovim. Both editors can be configured, but Neovim has better defaults.

For example, Neovim has the following knobs twisted by default:

  • autoindent is enabled by default
  • background defaults to "dark" unless explicitly set by the terminal
  • hlsearch (highlight all matches) is enabled by default

Though with newer releases of Vim, this may be subject to change as both editors are constantly evolving.

11 Pro Vim Tips to Get Better Editing Experience
You can learn plenty of Vim tips on your own, or you can learn it from others’ experiences.

Conclusion

Vim was created to improve the existing Vi editor. It stands for V Improved. Similarly, NeoVim was created to improve the existing Vim editor. It stands for New Vim.

I have been a Vim user for two years since I gave it a try and have happily migrated all of my Vim configurations to Neovim. This article outlines why someone might choose Neovim over traditional Vim.

Are you still using Vim? Do comment and let me know why! :)

Pratham Patel
Gujarat, India