1. Overview

Vim is a ubiquitous text editor that comes preinstalled with most major Linux distributions. Apart from being an extensible editor, it’s one of the most productive and efficient tools available to users and developers. However, NeoVim is an enhanced upgrade to Vim that incorporates more features.

In this article, we’ll compare Vim with its alternative implementation known as NeoVim. First, we’ll see the differences in the architecture between the two. Afterward, we’ll cover their plugin system, directory structure, and configuration.

Lastly, we’ll see how NeoVim’s GUI is different from the Vim GUI.

2. NeoVim in a Nutshell

NeoVim is a fork of Vim that addresses some of the core issues with Vim. One of the main objectives of NeoVim is to build an openly community-driven open-source project.

They are both identical in terms of their functionality. Therefore, we can make the best out of Vim using NeoVim without having to relearn the basic usage.

In terms of architecture, NeoVim is designed in a way that’s more performant and maintainable. So, the maintainable nature of NeoVim brings the entry barrier slightly down for anyone who is interested in contributing. As a result of that, NeoVim grows as software much faster.

3. Plug-in System

Vim’s plugin API is restrictive and cumbersome. The plugin architecture of NeoVim is a lot better than Vim. Apart from plugin implementation in Vimscript (VimL), we can also use the Lua programming language.

In addition, NeoVim has a lot more powerful plugins, which are not compatible with Vim. In particular, the remote plugin architecture of NeoVim enables us to extend the functionality of the editor by making remote procedure calls (RPCs). These calls can be made asynchronously through any programming language.

We can write plugins that are compatible with Vim and Neovim. For that reason, we can easily migrate our plugins to NeoVim with few-to-no modifications.

Moreover, plugin management is much easier in NeoVim due to the availability of numerous plugin managers.

4. Directory Structure

Vim has a hardcoded path for storing its plugins and configuration files. Usually, it’s the ~/.vim directory. Although it’s not impossible to change this hardcoded path, it’s still a lot of work as opposed to how NeoVim structures its configuration directory.

NeoVim follows the XDG Base Directory specification. Programs that follow this specification store their configuration files in the directory specified by the XDG_CONFIG_HOME environment variable. As a convention, it usually points to the ~/.config directory.

Therefore, NeoVim stores all its plugins and configuration files inside the ~/.config/nvim directory, which makes it adhere to the XBD specification.

5. LSP Support

NeoVim has out-of-the-box support for LSP. LSP stands for Language Server Protocol — a JSON-RPC-based protocol.

LSP enables NeoVim to communicate with a language server for language-specific features, such as code completion and code hinting. Using LSP is the defacto experience for using IntelliSense nowadays. One of the most notable plugins for this feature is coc.nvim.

6. Configuration

NeoVim comes with a better default configuration than Vim. For instance, different status line colors and cursor shapes for different modes.

Additionally, Vim and NeoVim are compatible with each other. So, we can use the configuration file of standard Vim with NeoVim. In order to do that, we need to symlink ~/.config/nvim/init.vim to our Vim config file:

$ ln -s ~/.vimrc ~/.config/nvim/init.vim

Afterward, we can put a check in our config file for both editors:

if has('nvim')
    " NeoVim specific commands
else
    " Standard Vim specific commands
endif

7. User Interface

Like Vim, NeoVim has a Tangible User Interface (TUI) that we can use inside any usable terminal. However, one addition NeoVim brings to the table is the terminal window. It’s very convenient and productive to have a terminal emulator beside our code editor.

Alternatively, NeoVim has a powerful, feature-rich GUI known as Oni, which allows us to leverage the power of modal editing without a terminal. Oni has a modern user interface, which overcomes the limitations that comes with using a terminal. Moreover, Oni is cross-platform and comes with several built-in plugins.

Apart from Oni, there are other open-source front-ends available for different platforms such as goneovim and VimR.

8. Conclusion

Vim and NeoVim both accomplish the same task. The difference is that NeoVim does it slightly better than Vim. Vim sees NeoVim as a direct competitor. As a result, the original developers of Vim are more open to bringing innovations to Vim, which in the absence of NeoVim wouldn’t have happened.

In this article, we discussed how NeoVim differs from Vim and why it’s an upgrade to the regular Vim. In addition, we highlighted several features of NeoVim that are superior to Vim, such as its plugin management, LSP, and its user-interface.

Comments are closed on this article!